Codeforces Round #444(Div. 2) A. Div. 64

来源:互联网 发布:2017优化最好的游戏 编辑:程序博客网 时间:2024/05/29 16:29

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

题意:给你一串由0和1组成的数字,问是否能够移除其中一些数字使得这串数字作为二进制数转换为十进制数之后能够整除64。

思路:因为是二进制数,所以如果能够整除64的话数字串的尾部一定会是1000000,而题目对于移除数字并没有限制,所以只需要判断是否在数字1后有6个数字0就可以了。

#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<iostream>#include<vector>using namespace std;char a[105];int main(){    int i,m,flag=0,ans=0;    scanf("%s",a);    int len=strlen(a);    for(i=0;i<len;i++)    {        if(a[i]-'0'==1)            flag=1;        if(flag)        {            if(a[i]-'0'==0)                ans++;        }    }    if(ans>=6)        printf("yes\n");    else        printf("no\n");    return 0;}