A - Div.64 /* Codeforces Round #444 (div.2) */

A. Div. 64
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

    Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills.

    Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some digits in such a way, that remaining number is a representation of some positive integer, divisible by 64, in the binary numerical system.

Input

    In the only line given a non-empty binary string s with length up to 100.

Output

    Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise.

Examples
input
100010001
output
yes
input
100
output
no
Note

In the first test case, you can get string 1 000 000 after removing two ones which is a representation of number 64 in the binary numerical system.

You can read more about binary numeral system representation here: https://en.wikipedia.org/wiki/Binary_system

 

题意:

给出一个小于100位的二进制数,判断移走任意个数的数字之后,能否变成一个能被64整除的数字。

 

解题思路:

直接数0的个数就好,注意这里的0需要在一个1出现以后才有效。

 

代码:

 1 #include <iostream>
 2 #include <cstdio>
 3 using namespace std;
 4 int main()
 5 {
 6     string s;
 7     cin>>s;
 8     int zero=0;
 9     int one=0;
10     int flag=0;
11     for(int i=0;i<s.size();i++)
12     {
13         if(s[i]=='0'&&flag)
14             zero++;
15         if(s[i]=='1')
16         {
17             one++;flag=1;
18         }
19     }
20     if(zero>=6&&one>=1)
21         printf("yes\n");
22     else
23         printf("no\n");
24     return 0;
25 }
A - Div.64

 

 

 

转载于:https://www.cnblogs.com/xxQ-1999/p/7803609.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值