Testing Round #14 (Unrated) A
来源:互联网 发布:原油api数据公布网站 编辑:程序博客网 时间:2024/06/05 15:39
#include<iostream>#include<algorithm>#include<iomanip>#include<cstdio>#include<cstdlib>#include<cstring>#include<string>#include<cmath>#include<set>#include<queue>#include<stack>#include<map>#define PI acos(-1.0)#define in freopen("in.txt", "r", stdin)#define out freopen("out.txt", "w", stdout)#define kuaidian ios::sync_with_stdio(0);using namespace std;typedef long long ll;typedef unsigned long long ull;const int maxn = 105 + 777, maxd = 1e8;const ll mod = 1e9 + 7;const int INF = 0x7f7f7f7f;int n, m;char s[maxn];int main() { scanf("%d%d", &n, &m); scanf("%s", s+1); if(s[1] == '0') return puts("-1")*0; int pos = 1, ans = 0; for(int i = 1; i < n; ) { int id = -1; for(int j = 1; j <= m && i+j <= n; ++j) { if(s[i+j] == '1') id = i+j; } if(id == -1) return puts("-1")*0; ans++; i = id; } printf("%d", ans); return 0;}
阅读全文
1 0
- Testing Round #14 (Unrated) A
- Codeforces Testing Round #14 (Unrated) A
- Codeforces Testing Round #14 (Unrated)
- Testing Round #14 (Unrated) B
- Testing Round #14 (Unrated) B
- Testing Round #14 (Unrated) C
- Codeforces Testing Round #14 (Unrated)
- Codeforces Testing Round #14 (Unrated)
- Codeforces Testing Round #14 (Unrated) B
- Codeforces Testing Round #14 (Unrated) C. Minimum Sum
- CodeForces Testing Round #8 A.IQ Test
- Codeforces Testing Round #10 A. Forgotten Episode
- codeforces-Testing Round #10 -A. Forgotten Episode
- Codeforces 597 A. Divisibility 【Testing Round #12】
- Codeforces Testing Round #8 / 328A IQ Test(模拟)
- Testing Round #12 (597A,597B,597C)
- Codeforces Testing Round #12 A. Divisibility( 容斥原理 )
- Codeforces Testing Round #3
- Python 正则表达式 关于邮箱地址
- latex算法书写
- p2p项目总结
- mysql日期时间操作函数详解
- 【SpringMVC】文件上传Expected MultipartHttpServletRequest: is a MultipartResolver错误解决
- Testing Round #14 (Unrated) A
- POJ 刷题系列:1860. Currency Exchange
- 【Java学习笔记】内部类
- 牛客网 Wannafly挑战赛6 逆序对(思路)
- 在IAR中的workspace增加下载代码选项
- Service Mesh 现在如此火热,你了解多少?
- TensorFlow RNN 文本情感分析
- Presto-[12]-Syntax-EXPLAIN
- label和span标签设置宽度width无效问题的解决方式