【每日一题(6)】Div. 64 CodeForces - 887A
2017-12-03 18:35
399 查看
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; }
相关文章推荐
- Codeforces 887A Div. 64
- codeforces 877 Div. 64
- codeforces 887 A题:Div. 64
- 887A Div. 64
- Codeforces Round #444 (Div. 2)A. Div. 64
- 【Codeforces】 Round #374 (Div. 2)
- Codeforces 922 div2 d、e、f
- CodeForces Div1: 995 D. Game(数学期望)
- Codeforces 374 Div2
- codeforces 789 div2 题解(AB水题,C dp,D图论)
- 【CodeForces】CodeForces Round #463 (Div. 1 + Div. 2) 题解
- 7/28 CodeForces Div2
- Codeforces 242(DIV 2) C题
- [DP 平衡树] Codeforces 809D Round #415 (Div. 1) D. Hitchhiking in the Baltic States
- 第三十二次codeforces竞技结束 #299 Div 2
- codeforces 299 div 2 (C Tavas and Karafs)
- 【Codeforces Round #376 (Div. 2)】 Codeforces 731E Funny Game
- codeforces 160 Div2 C
- [Codeforces]Round246 div2 解题报告
- 第二次codeforces竞技结束 #249 Div 2