G. Happy Line time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a larg…
题解 另g = gcd(a1,a2,a3....) 那么k * g % m的方案书就是答案 这个式子子显然是有循环节的 x * g = 0 mod m ,x * g + y * m = 0 exgcd 后 x = x0 + k * (m/gcd(g,m)) 也是就m/gcd(g,m) 代码 #include<map> #include<cstdio> #include<algorithm> using namespace std; int n,m; int a[1007…
D. Artsem and Saunders 题目连接: http://codeforces.com/contest/765/problem/D Description Artsem has a friend Saunders from University of Chicago. Saunders presented him with the following problem. Let [n] denote the set {1, ..., n}. We will also write f:…
A. Neverending competitions time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (f…