codeforces 887A Div. 64 思维 模拟
1 second
256 megabytes
standard input
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.
In the only line given a non-empty binary string s with length up to 100.
Print «yes» (without quotes) if it's possible to remove digits required way and «no» otherwise.
100010001
yes
100
no
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
代码:
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin>>s;
int len=s.length();
int cnt_zero=;
int cnt_one=;
for(int i=;i<len;++i) {
if(s[i]=='') cnt_zero++;
}
for(int i=;i<len;++i) {
if(s[i]=='') cnt_zero--;
if(s[i]=='') break;
}
if(cnt_zero>=) cout<<"yes"<<endl;
else cout<<"no"<<endl;
return ;
}
codeforces 887A Div. 64 思维 模拟的更多相关文章
- 887A. Div. 64#模特的数学技巧(字符串处理)
问题出处:http://codeforces.com/problemset/problem/887/A 问题大意:对于给出的一串二进制数,能否通过去掉一些数字,使之成为十进制下64的倍数 #inclu ...
- Codeforces 1087C Connect Three (思维+模拟)
题意: 网格图选中三个格,让你选中一些格子把这三个格子连起来,使得选中的格子总数最小.最后输出方案 网格范围为1000 思路: 首先两点间连起来最少需要的格子为他们的曼哈顿距离 然后连接方案一定是曼哈 ...
- Codeforces Round #444 (Div. 2)A. Div. 64【进制思维】
A. Div. 64 time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- 基于div表单模拟右对齐
基于div表单模拟右对齐 --------------------------------------------------------- ----------------------------- ...
- Codeforces Beta Round #27 (Codeforces format, Div. 2)
Codeforces Beta Round #27 (Codeforces format, Div. 2) http://codeforces.com/contest/27 A #include< ...
- codeforces #592(Div.2)
codeforces #592(Div.2) A Pens and Pencils Tomorrow is a difficult day for Polycarp: he has to attend ...
- codeforces #578(Div.2)
codeforces #578(Div.2) A. Hotelier Amugae has a hotel consisting of 1010 rooms. The rooms are number ...
- Codeforces #344 Div.2
Codeforces #344 Div.2 Interview 题目描述:求两个序列的子序列或操作的和的最大值 solution 签到题 时间复杂度:\(O(n^2)\) Print Check 题目 ...
- Codeforces #345 Div.1
Codeforces #345 Div.1 打CF有助于提高做题的正确率. Watchmen 题目描述:求欧拉距离等于曼哈顿距离的点对个数. solution 签到题,其实就是求有多少对点在同一行或同 ...
随机推荐
- LeetCode 48. Rotate Image(旋转图像)
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...
- thinkphp3.2开发网页实现第三方登录
1.在要添加登录的html里添加登录按钮: <a href="{:U('Public/login/',array('type'=>'weixin'))}">< ...
- struts2(五)之struts2拦截器与自定义拦截器
前言 前面介绍了struts2的输入验证,如果让我自己选的话,肯定是选择xml配置校验的方法,因为,能使用struts2中的一些校验规则,就无需自己编写了, 不过到后面应该都有其他更方便的校验方法,而 ...
- Description has only two Sentences(欧拉定理 +快速幂+分解质因数)
Description has only two Sentences Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 ...
- What Are You Talking About
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K (Ja ...
- 在ASP.NET Core中使用AOP来简化缓存操作
前言 关于缓存的使用,相信大家都是熟悉的不能再熟悉了,简单来说就是下面一句话. 优先从缓存中取数据,缓存中取不到再去数据库中取,取到了在扔进缓存中去. 然后我们就会看到项目中有类似这样的代码了. pu ...
- 数据库Oracle
一. 表空间和数据文件的关系: 文件组成:数据文件,控制文件,数据库日志文件 数据文件:.dbf 包含全部数据库数据(表,索引等),一个数据文件仅与一个数据库关联.一旦建立,只增不减. 表空间(Tab ...
- An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON
If you run into the following error message: An explicit value for the identity column in table '< ...
- Linux上jdk的安装
安装jdk a.检测是否安装了jdk 运行java -version b.若有需要将其卸载 c.查看安装那些jdk rpm -qa | grep java d. ...
- AutoMapper IIS回收引发的 未将对象引用设置到对象实例
一.前言 最近使用AutoMapper的时候,一段时间久会产生System.NullReferenceException:未将对象引用设置到对象的实例.这个问题.后来通过测试,发现部署在IIS上的站点 ...