Codeforces17A 题意: 有一种素数会等于两个相邻的素数相加 如果在2~n的范围内有至少k个这样的素数,就YES,否则就NO; 思路: 采用直接打表,后面判断一下就好了.那个预处理素数表还是满赞的~~ 不多说,上code-----. #include<bits/stdc++.h> #include<string.h> using namespace std; typedef long long LL; typedef unsigned long long ULL; con…
题目:http://codeforces.com/problemset/problem/620/C 文章末有一些测试数据仅供参考 题目大意 给你一个数字串,然后将分成几个部分,要求每个部分中必须有一对儿相等的数字,每个数字都属于某个部分,输出划分的部分数量以及对应区间.  思路 很简单一道题,输入的数据都不用存的,输入一个检测一个就好了,用map打标记,用容器存一下要输出的区间端点值,最后挨个儿输出就好了 代码如下: #include<iostream> #include<map>…
I - 9 Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 327B Description Iahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead o…
话说STL的I/O流用的还真不多,就着这道题熟练一下. 用了两个新函数: cout << std::setw(width[j]);    这个是设置输出宽度的,但是默认是在右侧补充空格 所以就要用cout.setf(ios::left);来设置一下左对齐. #include <iostream> #include <cstdio> #include <sstream> #include <vector> #include <string&g…
注意到R和C只与最后一个状态有关 /*H E A D*/ struct node2{ int kind,las,val,pos; node2(){} node2(int k,int l,int v,int p){ kind=k;las=l; val=v;pos=p; } }b[maxn]; bool cmp(node2 a,node2 b){ return a.las<b.las; } int mt[5003][5003]; int main(){ int n,m,k,op; while(~ii…
题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> using namespace std; ; const int INF = 0x3f3f3f3f;…
题目传送门 /* 水题:一开始看错题意,以为是任意切割,DFS来做:结果只是在中间切出一段来 判断是否余下的是 "CODEFORCES" :) */ #include <cstdio> #include <iostream> #include <cstring> #include <string> #include <algorithm> #include <cmath> #include <set>…
题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib> #include <cstring> ], a[]; ], c[]; int main(void) { //freopen("in.txt", "r", stdin); scanf("%s%s", n, a); int len1…
B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are n cities in Bearland, numbered 1 through n. Cities are arranged in one long row. The distance betwee…
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, mouse Brain was not accepted to summer school of young villains. He was upset and decided to postpone his plans of taking over the world, but to becom…