Hexadecimal's Numbers

在一个程序世界中,病毒Megabyte尝试通过加载数字到其妹妹Hexadecimal的记忆中获取能量控制权,但由于Hexadecimal仅能识别二进制数,导致部分数字无法被加载。本题需找出在1到n范围内能成功加载的数字数量。

One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n different natural numbers from 1 to n to obtain total control over her energy.

But his plan failed. The reason for this was very simple: Hexadecimal didn't perceive any information, apart from numbers written in binary format. This means that if a number in a decimal representation contained characters apart from 0 and 1, it was not stored in the memory. Now Megabyte wants to know, how many numbers were loaded successfully.

Input

Input data contains the only number n (1 ≤ n ≤ 109).

Output

Output the only number — answer to the problem.

Examples

Input

10

Output

2

Note

For n = 10 the answer includes numbers 1 and 10.

题解:水题一道;

代码:

#include <stdio.h>
#include <stdlib.h>
int n,m;
int sum;
int qiujie(int m)
{
    if(m>n) return 0;
    else sum++;
    qiujie(m*10);
    qiujie(m*10+1);
}
int main()
{
    scanf("%d",&n);
    sum=0;
    qiujie(1);
    printf("%d\n",sum);
    return 0;
}

 

Q21: Which of the following is a valid user-defined output stream manipulator header? a. ostream& tab( ostream& output ) b. ostream tab( ostream output ) c. istream& tab( istream output ) d. void tab( ostream& output ) Q22: What will be output by the following statement? cout << showpoint << setprecision(4) << 11.0 << endl; a. 11 b. 11.0 c. 11.00 d. 11.000 Q23: Which of the following stream manipulators causes an outputted number’s sign to be left justified, its magnitude to be right justified and the center space to be filled with fill characters? a. left b. right c. internal d. showpos Q24: Which of the following statements restores the default fill character? a. cout.defaultFill(); b. cout.fill(); c. cout.fill( 0 ); d. cout.fill( ' ' ); Q25: When the showbase flag is set: a. The base of a number precedes it in brackets. b. Decimal numbers are not output any differently. c. "oct" or "hex" will be displayed in the output stream. d. Octal numbers can appear in one of two ways. Q26: What will be output by the following statements? double x = .0012345; cout << fixed << x << endl; cout << scientific << x << endl; a. 1.234500e-003 0.001235 b. 1.23450e-003 0.00123450 c. .001235 1.234500e-003 d. 0.00123450 1.23450e-003 Q27: Which of the following outputs does not guarantee that the uppercase flag has been set? a. All hexadecimal numbers appear in the form 0X87. b. All numbers written in scientific notation appear the form 6.45E+010. c. All text outputs appear in the form SAMPLE OUTPUT. d. All hexadecimal numbers appear in the form AF6. Q28: Which of the following is not true about bool values and how they're output with the output stream? a. The old style of representing true/false values used -1 to indicate false and 1 to indicate true. b. A bool value outputs as 0 or 1 by default. c. Stream manipulator boolalpha sets the output stream to display bool values as the strings "true" and "false". d. Both boolalpha and noboolalpha are “sticky” settings.
05-24
access-list combined Description The access-list combined command is used to add Combined ACL rule. To delete the corresponding rule, please use no access-list extended command. Syntax access-list combined acl-id-or-name rule {auto | rule-id } {deny | permit} logging {enable | disable} [smac source-mac-address smask source-mac-mask] [dmac dest-mac-address dmask dest-mac-mask] [vid vlan-id] [type ether-type] [pri priority] [sip source-ip-address sip-mask source-ip-mask]] [dip destination-ip-address dip-mask destination-ip-mask] [dscp dscp-value] [tos tos-value] [pre pre-value] [protocol protocol [s-port s-port-number s-port-mask s-port-mask] [d-port d-port-number d-port-mask d-port-mask] [tcpflag tcpflag]] [tseg time-range-name] no access-list combined acl-id-or-name rule rule-id 413 Parameter acl-id-or-name —— Enter the ID or name of the ACL that you want to add a rule for. auto —— The rule ID will be assigned automatically and the interval between rule IDs is 5. rule-id —— Assign an ID to the rule. deny | permit —— Specify the action to be taken with the packets that match the rule. By default, it is set to permit. The packets will be discarded if “deny” is selected and forwarded if “permit” is selected. logging {enable | disable} —— Enable or disable Logging function for the ACL rule. If "enable " is selected, the times that the rule is matched will be logged every 5 minutes. With ACL Counter trap enabled, a related trap will be generated if the matching times changes. source-mac-address —— Enter the source MAC address. source-mac-mask —— Enter the source MAC address mask. dest-mac-address —— Enter the destination MAC address. dest-mac-mask —— Enter the destination MAC address mask. This is required if a destination MAC address is entered. vlan-id: The VLAN ID ranges from 1 to 4094. ether-type —— Specify the Ethernet-type with 4 hexadecimal numbers. priority —— The user priority ranges from 0 to 7. The default is No Limit. source-ip: Enter the source IP address. source-ip-mask —— Enter the mask of the source IP address. It is required if source IP address is entered. destination-ip —— This is required if a source IP address is entered. destination-ip-mask —— Enter the destination IP address mask. This is required if a destination IP address is entered. dscp-value —— Specify the DSCP value between 0 and 63. tos-value ——Specify an IP ToS value to be matched between 0 and 15. pre-value ——Specify an IP Precedence value to be matched between 0 and 7. protocol —— Specify a protocol type. s-port-number —— Specify the source port number. s-port-mask —— Specify the source port mask with 4 hexadecimal numbers. d-port-number —— Specify the destination port number. 414 d-port-mask —— Specify the destination port mask with 4 hexadecimal numbers. tcpflag —— For TCP protocol, specify the flag value using either binary numbers or * (for example, 01*010*). The default is *, which indicates that the flag will not be matched. The flags are URG (Urgent flag), ACK (acknowledge flag), PSH(push flag), RST(reset flag),SYN(synchronize flag), and FIN(finish flag). time-range-name —— The name of the time-range. The default is No Limit. Command Mode Global Configuration Mode Privilege Requirement Only Admin, Operator and Power User level users have access to these commands. Example Create Combined ACL 1100 and configure Rule 1 to deny packets with source IP address 192.168.3.100 in VLAN 2: Switch(config)# access-list create 1100 Switch(config)# access-list combined 1100 logging disable rule 1 permit vid 2 sip 192.168.3.100 sip-mask 255.255.255.255
最新发布
08-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值