A. Co-prime Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In each move you can i…
A. Digits Sequence Dividing(英文速读) 练习英语速读的题,我还上来昏迷一次....只要长度大于2那么一定可以等于2那么前面大于后面就行其他no 大于2的时候分成前面1个剩下后面一定是对的因为按照数字大小 代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n;…
这场比赛没有打,后来补了一下,第五题数位dp好不容易才搞出来(我太菜啊). 比赛传送门:http://codeforces.com/contest/1073 A. Diverse Substring 题意:给你个字符串,让你找一个子串满足任意一个字符的个数不超过其他字符的总和,输出yes或no表示否存在,如果存在输出任意一个. 这题只要找两个不同的相邻字符,因为两个字符各一个都不超过其他字符的总和,如果字符串只由一个字符组成或长度等于一才会不存在. 代码如下: #include <iostrea…
题目地址 先简单的总结一下这次CF,前两道题非常的水,可是第一题又是因为自己想的不够周到而被Hack了一次(或许也应该感谢这个hack我的人,使我没有最后在赛后测试中WA).做到C题时看到题目情况非常复杂,明显超出自己现在水平,卡了很久也没有好好做题.等了很长时间才开始看D题,而这时信心已经严重不足.赛后再看D题才发现自己比赛时理解错了题意,致使误以为题目非常复杂.而实际上,这个过程分析起来是非常容易的. 对于三种棱长度分别为a,b,c的石头,r最大为min(a,b,c)/2;. 如果两个石头要…
Beru-taxi 题目链接: http://codeforces.com/contest/706/problem/A Description Vasiliy lives at point (a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi…
链接: https://codeforces.com/contest/1263/problem/E 题意: The development of a text editor is a hard problem. You need to implement an extra module for brackets coloring in text. Your editor consists of a line with infinite length and cursor, which point…
(easy version): 题目链接:http://codeforces.com/contest/1296/problem/E1 题目一句话就是说,两种颜色不同的字符可以相互换位, 问,对这字符串用最多两种颜色染色,然后经过有限次换位 可以变成字典序排序的顺序. 思路:一个字符需不需要换位,应该是参照最后的字典序的顺序, 那么,我们应该给字符串排序,再去思考问题. 我们知道,如果str[now_i]的位置和排序后的位置不一样,那就是需要换位. 我们还知道,如果str[now_i]的当前位置如…
A. Co-prime Array 题目连接: http://www.codeforces.com/contest/660/problem/A Description You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In each move you can insert any positive integral number you want…
A. Co-prime Array http://codeforces.com/contest/660/problem/A 题意:给出一段序列,插进一些数,使新的数列两两成互质数,求插最少的个数,并输出这个序列. 思路:最优的就是插入1,1与非1的数都互质. #include<bits/stdc++.h> using namespace std; int gcd(int a,int b){ ?a:gcd(b,a%b); } int main(){ ,a[],b[]; scanf("%…
C. Hard Process 题目连接: http://www.codeforces.com/contest/660/problem/C Description You are given an array a with n elements. Each element of a is either 0 or 1. Let's denote the length of the longest subsegment of consecutive elements in a, consisting…