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("%…
E. Different Subsets For All Tuples 题目连接: http://www.codeforces.com/contest/660/problem/E Description For a sequence a of n integers between 1 and m, inclusive, denote f(a) as the number of distinct subsequences of a (including the empty subsequence)…
D. Number of Parallelograms 题目连接: http://www.codeforces.com/contest/660/problem/D Description You are given n points on a plane. All the points are distinct and no three of them lie on the same line. Find the number of parallelograms with the vertice…
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…
B. Seating On Bus 题目连接: http://www.codeforces.com/contest/660/problem/B Description Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capac…
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…
Description Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n. Consider that m (m ≤ 4n) people occupy the seats i…
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…