【每日一题(6)】Div. 64 CodeForces

来源:互联网 发布:贵阳大数据交易中心 编辑:程序博客网 时间:2024/05/18 23:28

Div. 64 CodeForces - 887A

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.

Example

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

题意

题目:输入一串二进制编码,问能否通过删除若干位数字使二进制编码变成64的倍数;
显然,64(2) → 1000000 128(2) → 10000000 192(2) → 11000000 256(2) → 100000000
即64的倍数在二进制中,后面必有6个0;题目便转化成了,判断1后是否存在6个或6个以上的0

题解

#include<stdio.h>#include<string.h>int main(void){    char a[100];    while(scanf("%s",&a) != EOF)    {        int i,t,x = 0,len = strlen(a);        for(i = 0;i < len; i++)        {            if(a[i] == '1')            {                for(t = i + 1;t < len; t++)                {                    if(a[t] == '0')                        x++;                    if(x == 6)                        break;                }            }            if(t == len)                break;        }        if(x >= 6)            printf("yes\n");        else            printf("no\n");    }    return 0;}