codeforces 887A Div. 64 思维 模拟

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

 

思路:

先统计有多少个0,然后从前往后数,遇到第一个1时,判断后面剩余的0的个数是否大于等于6

代码:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int main() {
 4     string s;
 5     cin>>s;
 6     int len=s.length();
 7     int cnt_zero=0;
 8     int cnt_one=0;
 9     for(int i=0;i<len;++i) {
10         if(s[i]=='0') cnt_zero++;
11     }
12     for(int i=0;i<len;++i) {
13         if(s[i]=='0') cnt_zero--;
14         if(s[i]=='1') break;
15     }
16     if(cnt_zero>=6) cout<<"yes"<<endl;
17     else cout<<"no"<<endl;
18     return 0;
19 }
View Code

 

posted @ 2017-11-04 13:52  lemonsbiscuit  阅读(502)  评论(0编辑  收藏  举报