Codeforces#360Div2
A题
题意:给定d个操作,每个操作当中只包含1和0,若存在0,则表示操作者获胜,求最大的连续获胜个数
分析:直接统计之后用一个数组纪录下来即可
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
const int maxn=;
int n,d;
int main()
{
while(cin>>n>>d)
{
string s[maxn];
for(int i=;i<d;i++)
cin>>s[i];
int vis[maxn];
memset(vis,,sizeof(vis));
for(int i=;i<d;i++){
for(int j=;j<n;j++){
if(s[i][j]==''){
vis[i]=;break;
}
}
}
int cnt=;
int mx=;
for(int i=;i<d;i++){
if(vis[i])
cnt++;
else
cnt=;
mx=max(mx,cnt);
}
cout<<mx<<endl;
}
return ;
}
B题
题意:求出第n大的数位为偶数的回文数
分析:因为是偶数位的回文数,所以必然可以分为前一半和后一半,两个不一样的数,前前一半大小必定不同,同时前一半可以为任意数,因此第n大的偶数位回文数就为前一半是n,后一半是n的转置
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
using namespace std;
string s;
int main()
{
while(cin>>s)
{
cout<<s;
reverse(s.begin(),s.end());
cout<<s<<endl;
}
return ;
}
Codeforces#360Div2的更多相关文章
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
- CodeForces - 261B Maxim and Restaurant
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...
- CodeForces - 696B Puzzles
http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...
- CodeForces - 148D Bag of mice
http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...
随机推荐
- 常用的opengl函数(三)
glBlendFunc 定义像素算法. void WINAPI glBlendFunc(GLenum sfactor,GLenum dfactor); 参数编辑 sfactor 指定红绿蓝和 al ...
- PHP全选择删除功能
<script type="text/javascript" language="javascript"> function selectBox(s ...
- boost库之graph入门
#include <boost/graph/undirected_graph.hpp> #include <boost/graph/adjacency_list.hpp> us ...
- Co-Debugging JNI with Android Studio and Visual Studio
Tutorials > Android > Integration with other tools > Co-Debugging JNI with Android Studio a ...
- PAT (Advanced Level) 1097. Deduplication on a Linked List (25)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- C# 中的内存管理,摘自网络
C#编程的一个优点是程序员不需要关心具体的内存管理,尤其是垃圾收集器会处理所有的内存清理工作.虽然不必手工管理内存,但如果要编写高质量的代码,还是要理解后台发生的事情,理解C#的内存管理.本文主要介绍 ...
- zf-关于<ww:iterator /> 标签中的<td /> 标签添加序号问题
一开始代码是这样的 那个<ww:if> 标签 是我添加的,可是添加之后出问题了. 因为我加了一个判断语句,使得不需要的信息没显示出来,导致#li.count 这个显示下标的方法行不通了 之 ...
- Shorten Diameter
Shorten Diameter Time limit : 2sec / Stack limit : 256MB / Memory limit : 256MB Score : 600 points P ...
- POJ 3660 Cow Contest 弗洛伊德
题意难懂是POJ的标配,这都TM赖本泽马. 题意:有N头牛进行了M场比赛,比赛双方是A - B 且总是A赢(前面的那个数赢),如果说A赢B,B赢C 则可以确定A赢C.问最终多少头牛的排名可以确定. 思 ...
- rm link
# this works rm foo # versus rm foo/