CodeForces 688A Opponents(群架)
来源:互联网 发布:网络黄金egd崩盘了吗 编辑:程序博客网 时间:2024/06/06 05:32
http://codeforces.com/problemset/problem/688/A
题意:
我翻译的就是打群架,当前行都为 1 ,对手到齐了就打不过,否则可以打过,
输出的是连续打过的最大天数。
思路:
建立一个Map数组,当前行存在 0 就赢了今天......
最后遍历就可以了。
Code:
#include<stdio.h>#include<cstring>const int MYDD=1103;const int MAXN=128;int ANS[MAXN];char Map[MAXN][MAXN];int main() {int n,d;while(scanf("%d%d",&n,&d)!=EOF) {// n 是列数for(int j=0; j<d; j++) {ANS[j]=0;scanf("%s",Map[d]);for(int k=0; k<n; k++) {if(Map[d][k]=='0') {ANS[j]=1;break;}}}int ans=0,now=0;ANS[d]=-1;for(int j=0; j<d; j++) {if(ANS[j])now++;else {if(now>ans)ans=now;now=0;}}if(now>ans)ans=now;printf("%d\n",ans);}return 0;}
0 0
- CodeForces 688A Opponents(群架)
- Codeforces-688A Opponents
- CodeForces 688A Opponents
- codeforces 688A Opponents
- 688A: Opponents
- Codeforces Round #360 (Div. 2) A Opponents(水题)
- Codeforces Round #360 (Div. 2) A. Opponents
- Codeforces Round #360 (Div. 2) A. Opponents
- Codeforces Round #360 (Div. 2) A. Opponents
- A. Opponents
- Codeforces Round #360 (Div. 2) A. Opponents(水题)
- Opponents
- Opponents
- CodeForces 688 A
- CodeForces 688A
- Codeforces 202(DIV2)A
- CodeForces 256A (dp)
- Presents(CodeForces 136A)
- poj1837
- 如何判断只能是数字,英文字母和中文 及获取androidmanifest.xml中meta-data的配置
- The Grammer of Graphics 读书笔记 - Introduction
- 深刻理解正则表达式的"组"以及"?:"
- 数据结构实验之求二叉树后序遍历和层次遍历
- CodeForces 688A Opponents(群架)
- 设计模式-模板模式
- HDU 1049 Climbing Worm
- Apache Commons CLI
- hbase协处理器引发的问题解决方案
- poj 2442 Sequence(贪心,堆)
- Java关键字volatile
- map函数的应用
- 复习(数据结构):图:c语言:邻接矩阵DFS和BFS