codeforces round 417 div2 补题 CF 812 A-E】的更多相关文章

A Sagheer and Crossroads 水题略过(然而被Hack了 以后要更加谨慎) #include<bits/stdc++.h> using namespace std; int main() { //freopen("t.txt","r",stdin); int a[4][4]; //memset(a,0,sizeof(a)); for(int i=0;i<4;i++) for(int j=0;j<4;j++) scanf(&…
A I'm bored with life 水题 #include<bits/stdc++.h> using namespace std; typedef long long int LL; const LL N=1,M=1,MOD=1; int main() {//freopen("t.txt","r",stdin); ios::sync_with_stdio(false); LL a,b; scanf("%I64d%I64d",&…
A Mister B and Book Reading  O(n)暴力即可 #include<bits/stdc++.h> using namespace std; typedef long long int LL; const LL N=1,M=1,MOD=1; int main() {//freopen("t.txt","r",stdin); int c,v0,v1,a,l; scanf("%d%d%d%d%d",&c,&…
A Karen and Morning 水题 注意进位即可 #include<bits/stdc++.h> using namespace std; typedef long long int LL; int a,b; bool pal() { if((a%10)==(b/10)&&(a/10)==(b%10))return true; else return false; } void add() { b+=1; while(b>=60)b-=60,a+=1; whil…
A An abandoned sentiment from past 水题 #include<bits/stdc++.h> using namespace std; int a[300],b[300],n,k; bool cmp(int a,int b) { return a>b; } int main() {//freopen("t.txt","r",stdin); scanf("%d%d",&n,&k); f…
A. Vladik and Courtesy 水题略过 #include<cstdio> #include<cstdlib> #include<cmath> using namespace std; typedef long long int LL; int main() { LL a,b; scanf("%I64d%I64d",&a,&b); LL num=1; while(true) { if(a<num){printf(&…
A Okabe and Future Gadget Laboratory 暴力 #include<bits/stdc++.h> using namespace std; typedef long long int LL; const LL N=51,M=1,MOD=1; int num[N][N]; int main() { ios::sync_with_stdio(false); //freopen("t.txt","r",stdin); int n;…
A Treasure Hunt 注意负数和0的特殊处理.. 水题.. 然而又被Hack了 吗的智障 #include<bits/stdc++.h> using namespace std; int main() { int sa,sb,da,db,x,y; scanf("%d%d%d%d%d%d",&sa,&sb,&da,&db,&x,&y); sa=da-sa;sb=db-sb; if(sa<0)sa*=-1; if(…
A DZY Loves Hash 水题 #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> using namespace std; bool f[300]; int main() { long long int p,t; int i,j,k,m,n; cin>>p>>n; bool fs=0; memset(f,0,sizeof(f)); f…
[第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了:) +传送门+ ◇ 简单总结 前两道题非常OK,秒掉还好.心态爆炸是从第三题开始的……一开始设计的判断方法没有考虑0,然后就错了很多次,然后改了过后又没有考虑整个数要分成2个及以上的数,继续WA,最后整个程序删了重新魔改了一次终于AC.感觉最后的AC代码的复杂度要比原来高一些,但是毕竟AC了,还是不…
Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可以按照这个顺序排列 然后根据\(n\)的大小搞一搞就好了 #include<cstdio> #include<cctype> #include<cstring> #include<algorithm> #include<iostream> #incl…
Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin(), pos.end()), pos.end());if (pos.size() == 0) pos.push_back(0);int id = lower_bound (pos.begin(), pos.end(), q[i].time) - pos.begin(); II java输入输出带模…
Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Finding Team Member codeforces 579C A Problem about Polyline codeforces 579D "Or" Game codeforces 579E Weakness and Poorness codeforces 579F LCS Aga…
比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大小为$n$的a数组,求下面式子的结果: $$ (a_1 + a_2) \oplus (a_1 + a_3) \oplus \ldots \oplus (a_1 + a_n) \\ \oplus (a_2 + a_3) \oplus \ldots \oplus (a_2 + a_n) \\ \ldot…
补一下codeforces前天教育场的题.当时只A了一道题. 大致题意: 定义一个x - y - counter :是一个加法计数器.初始值为0,之后可以任意选择+x或者+y而我们由每次累加结果的最后一位生成一个数列. 例如:4 - 2 - counter 进行+4 +4 +4 +4 +2 +4操作会生成数列 04824.每步要加上x或y是任意的. 给你一个数列(由0~9组成的字符串),问你0~9中全部两个数字生成这个包含这个子串的数列中间至少要插入多少数字.以10 * 10矩阵格式输出. 例如…
ProblemA(Codeforces Round 689A): 题意: 给一个手势, 问这个手势是否是唯一. 思路: 暴力, 模拟将这个手势上下左右移动一次看是否还在键盘上即可. 代码: #include <cmath> #include <cstdio> #include <cstring> #include <cstdlib> #include <ctime> #include <set> #include <map>…
A-C传送门 D Karen and Cards 技巧性很强的一道二分优化题 题意很简单 给定n个三元组,和三个维度的上限,问存在多少三元组,使得对于给定的n个三元组中的每一个,必有两个维度严格小于. 首先我们根据一个维度(c维)对n个三元组排序,然后枚举答案在这个维度的取值. 此时序列被分成了两个部分,前半部分 满足所有c大于等于i 后半部分满足所有c严格小于i(即已有一个维度小于) 通过累计,我们知道此时前半部a维的最大值ma和b维的最大值mb. 显然可能存在的三元组答案,必然首先满足a维和…
A The Contest 直接粗暴贪心 略过 #include<bits/stdc++.h> using namespace std; int main() {//freopen("t.txt","r",stdin); long long int n,sum=0,k; scanf("%lld",&n); for(int i=0;i<n;i++) { scanf("%lld",&k); sum…
*明早起来再贴代码 A [题意] 给定n*5的方格 将横向的相邻两个变成+输出 [题解] ... B [题意] 一个n*n的正整数矩阵,有且仅有一个数为0 ,在这个位置填上一个数,使得每一列的和 每一行的和 两条对角线各自的和都相等 输出这个数 [题解]sb题.暴力一下.注意细节,否则你就像这样 (不是本人 C [题意] 一排点,用1~n表示,熊孩子要给这些点上色.最初每个点的颜色为ci.一共有m种颜色,如果ci=0表示这个点最初无色. 熊孩子们需要给最初为无色的点涂上色,往第i个点涂颜色j需要…
开场心理活动:啊打完这场大概有1700了吧 中途心理活动:啊这个ABC看起来都随便做啊 死亡原因:欸怎么没网了 -75 .. A [题意]Hulk说完一句I hate会说that I love 然后是hate love循环.. 我前面大小写打错了以为自己过了样例又WA了一发 [题解]傻逼题 B [题意]对于一堆大小为x石子,可以把他分成p,x-p两堆(p>0,x>p),先后手进行,无法操作的输,每次加进一堆石子,查询加上这堆之后的胜负情况 对于单个石子,只要查看x的奇偶性即可,但是由于多堆石子…
题目传送门:http://codeforces.com/contest/957/problem/D 题意大致是这样的:有一个水池,每天都有一个水位(一个整数).每天都会在这一天的水位上划线(如果这个水位已经被划线了,那么不划线). 现在告诉你每天能看见的线条mi(就是高于水面的,刚好在水面的不算),设di为第i天水面以下的线条数(刚好在水面的不算),求(d1+d2+d3....dn)的最小值. 解析: 我们设第i天有ki条水位线,容易得到: 移项后,将d留在右边,我们发现mi和n都是固定的,所以…
第一题没话说 智商欠费 加老柴辅导终于过了 需要在意的是数据范围为2的63次方-1 三个数相加肯定爆了 四边形的定义 任意边小于其余三边之和 换句话说就是 最长边小于其余三边之和 这样的话问题转化为 最长边依次减其余三边的结果是否小于等于0 还有一点是题目出现0边 即最小边不为0 想得太多反而把0也算为合法.... 问题只需要 sort一下 判断a[0]==0||a[3]-a[2]-a[1]-a[0]>=0 输出NO //存在0边且最大边大于其他边之和 第二题 好多种姿势 题目链接http://…
凌晨起来打CF,0:05,也是我第一次codeforces 第一题: 我刚开始怀疑自己读错题了,怎么会辣么水. 判除了0的数字种类 #include <cstdio> ; ]; int main(){ scanf("%d",&n);int i; ;i<=n;++i){ ; } printf("%d",ans); } 第二题:让你找一个x使x<=y且x不能被[2,p]内的数整除,使x尽量大 其实是暴力枚举. #include <c…
Bank Hacking 阅读题,读完之后手算一下可以发现每一个bank被hack所需要的strength无非分为三种情况. 1. $a_i$,当且仅当i为第一个选择的点. 2. $a_i+1$,当且仅当i是第一个选择的点的neighborhood. 3. $a_i+2$,其他所有点. 这样,分类讨论即可. http://codeforces.com/contest/796/submission/26318700 Police Stations 猜想题,可以注意到因为给定的图是树,那么每删除一条…
FST ROUND !!1 A Three swimmers: 直接整除一下向上取整就好了: #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2e5 + 10; ll p,a,b,c; int main() { ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); int times; cin >> times; w…
这次出的题水爆了,借着这个机会终于把CF的号变蓝了.A. Helpful Mathstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputXenia the beginner mathematician is a third year student at elementary school. She is now learning the add…
This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contempted.The problem in Div2 was so...em,how to say,anyway I even daren't to believe.Yesterday I solved two fifths of problems.You see? I'm just a guy full…
Problem_A(CodeForces 686A): 题意: \[ 有n个输入, +\space d_i代表冰淇淋数目增加d_i个, -\space d_i表示某个孩纸需要d_i个, 如果你现在手里没有\space d_i个冰淇淋, 那么这个孩纸就会失望的离开.\] 你初始有x个冰淇淋. 问最后有多少个孩纸失望的离开了. 思路: 模拟就好了, 判断当前的数目是否足够. 代码: #include <cmath> #include <cstdio> #include <cstr…
C题:这题说的是套娃,如果做题的时候知道是套娃,那就好理解多了 规则1:套娃A可以放到套娃B里面,当且仅当套娃B没有放在其他套娃里面 规则2:套娃A放在套娃B里面,且套娃B没有放在其他套娃里面,那么可以把A从B中拿出来 问我们最少要操作多少次,才能将套娃全部套起来,拆开和组装都算是一次操作 思路:找到序号为1的套娃的哪一组,然后统计该组有多少个套娃是连在1后面,且每次序号都是加1的,那么这些个套娃是不用拆开的.那么剩下的套娃都是要拆开的 #include <stdio.h> #include…
题目大意: A简单的说就是,有五个人,他们刚开始有B元,经过一系列过程后,给你他们现在分别有的钱,让你求出B(> <难得的傻逼题啊...但是要注意B是正整数!特判0) B有n个人,要分成m组,同组的两个人可为一对,问你形成的最多队和最少队(> <用贪心思想+排列组合乱搞搞就过了...) C有三种颜色的球,给你他们分别的数量,让你用这三种球装饰一个表?,只要满足三种颜色不完全相同就可以了,问你最多能装饰多少个表? D给你两种颜色的block,让你搭一个R-G tower(不需要红绿相…