【每日一题(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 100010001Output yes
Input 100Output 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;}
- 【每日一题(6)】Div. 64 CodeForces
- 每日一题 CodeForces
- 【每日一题(22)】Hamburgers Codeforces Round
- 【每日一题(8)】Mammoth's Genome Decoding CodeForces
- 每日一题(6):
- 算法每日一题:6、反序数
- 面试—每日一题(6)
- 每日一题6:位图向量排序
- leetcode每日一题:(6)ZigZag Conversion
- 每日一练6
- 每日一题2
- 每日一题
- 每日一题12.20
- 每日一题
- Javascript每日一题
- 每日一题
- Mysql每日一题
- 每日一题-1
- [Initial] Build: PL By: JS
- 网络 一一 HTTP 和 TCP/IP 的区别
- JAVA中的泛型(1)
- .NETCore 知识点记录-QuartzCore 定时任务
- [Unity][资源分享][精华分享]Unity官方教程素材分享
- 【每日一题(6)】Div. 64 CodeForces
- 日期的三级联动(纯js)
- 统计学习方法(第二章)感知机
- 【技术重温】html之概述
- Link-Cut Trees 板子
- 2017.12.03.学习日记(集合)
- 消息队列系列之ActiveMQ(JMS、集群配置)
- 微信小程序-项目案例 (三)全局变量及封装网络请求
- Jquery-选择器