CodeForces专题提供CodeForces的最新资讯内容,帮你更好的了解CodeForces。
大意: 划分1-n的集合,将其分为两个,要求两个集合的和之差最小。 求集合(任意输出) 思路: 容易想到,首位配对的方法去取出来,差值必为0或1(差值为绝对值) 难点在选取。 现在知道差值为0或1 按照奇偶分为两个集合 从后往前检查,如果差值不为0或1 那么讲两个数字交换,交换后必然导致差值-2 当差值为0或1的时候,停止交换,即为答案。 实现代码: #include <bits/stdc++.h
大意: 给出一个数 n 求 1<= a , b <= n , 记 N = a +b 求末尾有最多连续的9的N,a,b 有多少(无序)组。两组是不同的当且仅当 有一个数不同。 样例解释: input 14 output 9 hint: In the example the maximum number of nines at the end of total cost of two shovels
A; A. Visiting a Friend time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pig is visiting a friend. Pig's house is located at point 0, and hi
比赛链接: Div.2 #453 A Visiting a Friend 大意: 0要达到线段上的某一点m, 已知线段上有若干个传送点a,a可传送到 [a,b] 上的任意一点,求能否从0到m点。 思路: 记录当前能到达的最远点 s,不断更新,判断是否能到达(s>=m)即可。 代码实现: #include <bits/stdc++.h> using namespace std; int main()
这套题有史以来做的最恶心的一套题,没有之一; A题,讲的不明不白的。到底是区间还是这4个数,没有说明白, 交了7遍 全都是WA on test 4;因为一直认为就是这4个数里面选择 ,恶心, 实际要求是在区间里选定某个值; 暴力枚举!!!!!!! A: A. Masha and Bears time limit per test 2 seconds memory limit per test 25
A; A. Generate Login time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The preferred way to generate user login in Polygon is to concatenate
A 注意是数组中最小那个数的最近相邻距离 #include <cstdio> #include <cstring> #include <cmath> #include <cstdlib> #include <ctime> #include <iostream> #include <algorithm> #include <sstream> #include <string> #include <v
http://codeforces.com/contest/909 差F题了,有机会再补吧。F是思维题。 断断续续补了好久。。 比赛就做了A,B 。 A 给你两个名字,要求一个名字由这两个的前缀拼接顺序而成并且字典序最小。 把问题转化一下,想要长度最小,最后一个名字只取首字母。 然后在第一个名字内找比 二名字首字母小的字母 #include <bits/stdc++.h> using namesp
D. Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Little Mishka enjoys programming. Since her birthday has j
D. Friends and Subsequences time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Mike and !Mike are old childhood rivals, they are opposite in
A: A. Supermarket time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We often go to supermarkets to buy some fruits or vegetables, and on the
C. The Monster time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As Will is stuck in the Upside Down, he can still communicate with his mom,
C. A Twisty Movement time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day,
A. Love Triangle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you could know there are no male planes nor female planes. However, eac
0x00 前言 时隔好久,又想着忙里偷闲打一场codeforces活动下快要生锈的脑袋 emmmm,虽然手忙脚乱只出了三题,但实在是手生也还凑合了…… D题也有思路,日后再补上吧,把赛中做出的三题写一写,聊以纪录。 这次的教训就是:以后打codeforces不要作死加 ios::sync_with_stdio(false); 0x01 A. Links and Pearls 题目传送门:http:
0x00 前言 感觉上次打了一场热身之后,脑子都转的灵活些了,果然一定要多写题防生锈, 这次两个小时的CF Div2,打了一个半小时不到出了三题,第四题恕我看题意都看睡着了, 然后抱着出了三题的喜悦去休息了,早上起来一看,FST了……QAQ 原因居然是写完了代码之后脑子有问题的加了一个特判,当时脑子里想的是,加个速加个速,加毛线啊QAQ 不要这个特判才是对的呀! 0x01 A. Pizza, Pi
0x00 前言 啥都不说了,居然出了四题, 令我不仅产生了错觉:老选手也能有朝一日恢复到刚开始集训时的状态? 觉得浑身充满了活力QvQ!(可惜了这次用的不是自己的号QvQ,220名呀……) 那么这次比赛得到了一个怎样的教训呢?(看见那些TLE了么) ——老老实实给我用 printf() 和 scanf()! ——竞技编程除非字符串处理,没有 cin>> 和 cout<< ! 0x01 A. Gam
A题: http://codeforces.com/contest/989/problem/A 满足ABC三个相邻就可以. #include <bits/stdc++.h> typedef long long ll; const int MAXN = 1e5 +10; #define fastIO ios_base::sync_with_stdio(0); using namespace std
题目链接:Codeforces Round #491 (Div. 2) A. If at first you don’t succeed… 题目类型: 容斥 题意: 题目大意是要进行一次考试,有人考好了有人没考好,考好的人都会去餐馆吃饭,餐馆有两个,有A个人去了第一个餐馆,有B个人去了第二个餐馆,有C个人两个餐馆都去了,现在问有多少人没有考好. 样例给出是给出了A,B,C,N的值,如果合法就输出没