Codeforces Round #671 (Div. 2) (A~E)】的更多相关文章

Link~ 题面差评,整场都在读题 A 根据奇偶性判断一下即可. #include<bits/stdc++.h> #define ll long long #define N #define rep(i,a,n) for (int i=a;i<=n;i++) #define per(i,a,n) for (int i=n;i>=a;i--) #define inf 0x3f3f3f3f #define pb push_back #define mp make_pair #defin…
A - Elections 题意: 每一场城市选举的结果,第一关键字是票数(降序),第二关键字是序号(升序),第一位获得胜利. 最后的选举结果,第一关键字是获胜城市数(降序),第二关键字是序号(升序),第一位获得胜利. 求最后选举获胜者. 思路: 直接模拟就可以. 代码: /* * @author FreeWifi_novicer * language : C++/C */ #include<cstdio> #include<iostream> #include<cstrin…
点我看题目 A. Mashmokh and Lights time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard output Mashmokh works in a factory. At the end of each day he must turn off all of the lights. The lights on the factory a…
题目:http://codeforces.com/problemset/problem/584/D 思路: 关于偶数的哥德巴赫猜想:任一大于2的偶数都可写成两个素数之和. 关于奇数的哥德巴赫猜想:任一大于7的奇数都可写成三个质数之和的猜想. #include<cstdio> #include<cstring> #include<cmath> #define ll long long using namespace std; bool isprime(ll n) { ;i…
2.2.2017 9:35~11:35 A - Taymyr is calling you 直接模拟 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; typedef long long ll; ; inline int read(){ ,f=; ; c=getcha…
---恢复内容开始--- Kurt reaches nirvana when he finds the product of all the digits of some positive integer. Greater value of the product makes the nirvana deeper. Help Kurt find the maximum possible product of digits among all integers from 1 to n. Input…
题目 传送门:QWQ A:A - If at first you don't succeed... 分析: 按照题意模拟 代码: #include <bits/stdc++.h> using namespace std; int main(){ int a,b,c,n; scanf("%d%d%d%d",&a,&b,&c,&n); int ans=n-a-b+c; ; ) printf("%d\n",ans); else…
题目 传送门:QWQ A:A - Hit the Lottery 分析: 大水题 模拟 代码: #include <bits/stdc++.h> using namespace std; int main(){ int n; ;scanf("%d",&n); ){ x++; n-=; } ){ x++; n-=; } ){ x++; n-=; } ){ x++; n-=; } printf("%d\n",x+n); } B:B - World C…
这场比赛手速场+数学场,像我这样读题都读不大懂的蒟蒻表示呵呵呵. 第四题搞了半天,大概想出来了,但来不及(中途家里网炸了)查错,于是我交了两次丢了100分.幸亏这次没有掉rating. 比赛传送门:https://codeforces.com/contest/1080. A.Petya and Origami 题意:Petya要发出n张邀请函,每张请函需要2张红纸,5张绿纸,8张蓝纸.现在商店里有一些不同颜色的笔记本,每本中有k张颜色相同的纸,求最少要买几本笔记本. 这题就是一道模拟题,算出每种…
Codeforces Round #624 (Div.3) 题目地址:https://codeforces.ml/contest/1311 B题:WeirdSort 题意:给出含有n个元素的数组a,和m个元素的数组p,p中元素表示可调换(p=[3,2]表示a中下标为3和下标为3+1的元素可调换,2和2+1可调换),问能否使得原数组成为非降序数组 思路:暴力,模仿冒泡排序 AC代码: #include<bits/stdc++.h> typedef long long ll; using name…
Codeforces Round #253 (Div. 1) 题目链接 A:给定一些牌,然后如今要提示一些牌的信息,要求提示最少,使得全部牌能够被分辨出来. 思路:一共2^10种情况,直接暴力枚举,然后对于每种情况去推断,推断的时候仅仅要两两张牌枚举出来推断就可以.不得不说CF机子真心强大,2秒限制还是能跑10^8 B:给定n个发生概率,求选出当中一些事件,使得正好有一件发生的概率最大. 思路:贪心,从大到小排序概率,然后一个个概率进来推断有没有更大,有就增加该事件,没有就跳过 C:给定n个数字…
戳我看题目 A:给你n个数,要求尽可能多的找出匹配,如果两个数匹配,则ai*2 <= aj 排序,从中间切断,分成相等的两半后,对于较大的那一半,从大到小遍历,对于每个数在左边那组找到最大的满足条件的数配对 用一个变量移动一下就好了.这样的配对数量肯定就是最多的. 因为 1:如果左边那一半数量取少一点,比如取a1 a2 a3...ak (k < n/2) 那实际上ak+1 ak+2 .. a n/2 这些数就没啥用了,因为后面那一半数已经足够匹配当前的这些数了,不可能后面还有某些数不匹配而拿这…
题目链接:http://codeforces.com/contest/1138/problem/D 题目大意:给你两个字符串s1和s2(只包含0和1),对于s1中,你可以调换任意两个字符的位置.问你最多能在s1中构造出几个s2(可重叠). 具体思路:首先找到字符串s2的最小循环节,比如说1101,我们找到的最小循环节就是101,这样的话,我们每次在后面加上101就能构造出一个新的1101了,最小循环节是最小的代价. AC代码: #include<bits/stdc++.h> using nam…
比赛链接:https://codeforces.com/contest/1419 A. Digit Game 题意 给出一个 $n$ 位数,游戏规则如下: 1-indexed Raze标记奇数位 Breach标记偶数位 如果最后剩下的一位未标记位上的数字为奇数,Raze胜,为偶数,Breach胜 问Raze先手能否胜利. 题解 根据 $n$ 的奇偶性可得最后的未标记位的奇偶性,然后判断该奇偶性的位置上是否存在奇数或偶数即可. 代码 #include <bits/stdc++.h> using…
题目链接 A. Game With Sticks time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard output After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a g…
总评 今天是个上分的好日子,可惜12:30修仙场并没有打... A. Snowball(小模拟) 我上来还以为直接能O(1)算出来没想到还能小于等于0的时候变成0,那么只能小模拟了.从最高的地方进行高度的模拟,如果遇到石头就去判断一下会不会小于0其他没有什么好说的了 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int…
Codeforces Round #543 Div1题解 Codeforces A. Diana and Liana 给定一个长度为\(m\)的序列,你可以从中删去不超过\(m-n*k\)个元素,剩下的元素从左往右每\(k\)个一组,最后一组可以不满.给定你一个大小为\(|S|\)的可重集,要求你分出的组中至少有一组构成的可重集包含了给定的可重集. 构造一种符合条件的删数方案. \(n,m,k,|S|\le 5*10^5\) 写了\(1h\)才过,感觉身败名裂. 考虑枚举一个右端点\(r\),显…
C. Cardiogram time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem, your task is to use ASCII graphics to paint a cardiogram. A cardiogram is a polyline with the following corner…
https://codeforces.com/contest/1228/problem/A A. Distinct Digits 超级简单嘻嘻,给你一个l和r然后寻找一个数,这个数要满足的条件是它的每一位的数字不相同,找出满足要求的最小的那个数输出,没有找到就输出-1: #include<bits/stdc++.h> using namespace std; bool check(int n){ ]={}; while(n){ ]) vis[n%]=; else return false; n…
题目链接: Problem - 1419B - Codeforces 题目 题意 给x个格子,你可以用这x个格子去拼成楼梯 好的楼梯的要求如下: 1. 第n列有n个格子 2. 这个楼梯的所有格子可以被划分为几个正方形,正方形的个数必须=n,一个正方形可以由至少一个格子组成 输出可以用x个格子去拼成几个不一样的好的楼梯 解析 看看例子,会发现只有当n=1,3,7......时,才可以是好的楼梯 解释:前面排好的不动,后面加一个大正方形,上面放的和前面排好的一样 里面阴影部分就是前面的复制到新正方体…
文章目录 原题链接: A.Cirno's Perfect Bitmasks Classroom 思路 代码 B.Patchouli's Magical Talisman 思路 代码 C.Manipulating History 思路 代码 D.The Enchanted Forest 思路 代码 E.Railway System 题目大意 思路 代码 原题链接: # Name A Cirno's Perfect Bitmasks Classroom standard input/output 1…
#include<iostream> #include<cstring> #include<cstdio> /* 题意:计算f(n) = -1 + 2 -3 +4.....+(-1)^n *n的值 思路:偶数和 - 奇数和(或者用等差数列计算化简得到结果) */ #include<algorithm> #define N 10000 using namespace std; int main(){ long long n; cin>>n; ==)…
Blake is a CEO of a large company called "Blake Technologies". He loves his company very much and he thinks that his company should be the best. That is why every candidate needs to pass through the interview that consists of the following probl…
A. Helpful Maths 题目大意 给一个连加计算式,只包含数字 1.2.3,要求重新排序,使得连加的数字从小到大 做法分析 把所有的数字记录下来,从小到大排序输出即可 参考代码 #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> using namespace std; ; ]; ], n; int main() { scanf("%s…
D:没有注意到a==0&&b==0的情况,把自己卡崩了.对于数学公式推导一定要注意关于0的特殊情况,不可以少 #include <iostream> #include <cstring> #include <string> #include <map> #include <set> #include <algorithm> #include <fstream> #include <cstdio>…
c被fst了................ 然后掉到600+.... 然后...估计得绿名了.. sad A.I Wanna Be the Guy 题意:让你判断1-n个数哪个数没有出现.. sb题...开个数组即可.. #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #include <algorith…
蛋疼的比赛,当天忘了做了,做的模拟,太久没怎么做题了,然后C题这么简单的思路却一直卡到死,期间看了下D然后随便猜了下,暴力了下就过了. A.找一个能被t整除的n位数,那么除了<=10以外,其他都可以用长度为n的10或100,1000 ... 来往上加几个数而得到 #include <iostream> #include <stdio.h> #include <set> #include <algorithm> #include <string.h…
D2. Kirk and a Binary String (hard version) time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The only difference between easy and hard versions is the length of the string. You can hack this pro…
https://codeforces.com/contest/1234/problem/A A. Equalize Prices Again #include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n,a; int t; cin>>t; ll sum = ,ans; while(t--){ cin>>n;sum = ; ;i < n;++i){ cin&g…
A略 直接求和最大的子序列即可(注意不能全部选中整个子序列) or #include<bits/stdc++.h> using namespace std; void solve(){ int n; cin>>n; vector<int> a(n); vector<long long> sum(n+1,0); for(int i=0;i<n;i++) scanf("%d",&a[i]); for(int i=1;i<=…