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的更多相关文章

  1. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  2. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  3. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  4. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  5. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  6. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  7. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

  8. CodeForces - 696B Puzzles

    http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...

  9. CodeForces - 148D Bag of mice

    http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...

随机推荐

  1. UVALive 2678 大于s的最短子序列和

    input n s 10<=n<=100000,s<1e9 a1 a2 ... an  ai<=10000 output 大于s的最短子序列和的长度,没有输出0 #includ ...

  2. 最短路<dijk>

    题意: 有n个城市,有m条路,给出每条路的出发和结束的城市及长度,求从第一个城市到最后一个城市的最短路.按格式输出. power oj 2443 题解: 标准dijk算法. #include<c ...

  3. php 四种基础算法 ---- 选择排序法

    2. 选择排序法: 选择排序法思路: 每次选择一个相应的元素,然后将其放到指定的位置 代码: function select_sort($arr) {//实现思路 双重循环完成,外层控制轮数,当前的最 ...

  4. 用for、while、do-while循环输出10句“好好学习,天天向上!”

    #include "stdio.h" void main() { int time; ;time<=;time++) printf("%d.好好学习,天天向上!\n ...

  5. TcpClient 读写流

    TcpClient 读写流 TcpClient tcp = new TcpClient(); tcp.Connect(IPAddress.Parse("192.168.1.161" ...

  6. magento head.phtml 加载<a target=_parent

    <script language="javascript">function alinks(){  var links = document.getElementsBy ...

  7. js List<Map> 将偏平化的数组转为树状结构并排序

    数据格式: [ { "id":"d3e8a9d6-e4c6-4dd8-a94f-07733d3c1b59", "parentId":&quo ...

  8. 交换机VLAN、 TRUNK 、VTP 配置

    交换机VLAN. TRUNK .VTP 配置 1. 配置 CISCO 二层交换机的IP 地址(catalyst 2950 为例) SW1(config)#int vlan 1 //进入管理接口inte ...

  9. Android----paint触摸轨迹监听

    paint触摸轨迹监听,主要是三种而已,ACTION_DOWN,ACTION_MOVE,ACTION_UP public boolean onTouchEvent(MotionEvent event) ...

  10. QT中LineEdit、TextEdit 、PlainTextEdit 三个控件的区别

    QLineEdit是单行文本输入,一般用于用户名.密码等少量文本交互地方.QTextEdit用于多行文本,也可以显示HTML格式文本.QPlainTextEdit与QTextEdit很像,但它多用于需 ...