[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 记录下水龙头在哪些位置. 然后每秒钟把index-i和index+i改变状态一下就好(置1 [代码] #include <bits/stdc++.h> using namespace std; const int N = 200; int n,k; int a[N+10],x[N+10]; int ok(){ for (int i = 1;i <= n;i++) if (a[i]==0) return 0; return…
F. The Sum of the k-th Powers 题目连接: http://www.codeforces.com/contest/622/problem/F Description There are well-known formulas: , , . Also mathematicians found similar formulas for higher degrees. Find the value of the sum modulo 109 + 7 (so you shoul…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 显然最后会形成多个集合,每个集合里面的人能够可以互相到达. 则维护并查集的时候,顺便维护一下每个集合里面的最小值就好. 最后答案就为∑min{每个集合} [代码] /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.Can you promise that the solution is rig…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 把所有的那些数字打表出来. 逆序枚举就好 [代码] /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.Can you promise that the solution is right? At least,the main ideal 4.use the puts("") or p…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟题.知道哪个人是旁观者就好 [代码] /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.Can you promise that the solution is right? At least,the main ideal 4.use the puts("") or putcha…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 找到任意一个环. 然后枚举删掉其中的某一条边即可. (因为肯定要删掉这个环的,那么方法自然就是删掉其中的某一条边 (其它环,如果都包括这条边,那么就可以,否则,某个环不包括那也没办法,自然就无解了. 这样枚举的边的数目最多是500(环最多N条边) 然后复杂度就是500*10万了. 足够过了 [代码] /* 1.Shoud it use long long ? 2.Have you ever test several sample…
The Sum of the k-th Powers There are well-known formulas: , , . Also mathematicians found similar formulas for higher degrees. Find the value of the sum modulo 109 + 7 (so you should find the remainder after dividing the answer by the value 109 + 7).…
Educational Codeforces Round 37 (Rated for Div. 2)C. Swap Adjacent Elements time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have an array a consisting of n integers. Each integer from 1…
Educational Codeforces Round 40 F. Runner's Problem 题意: 给一个$ 3 * m \(的矩阵,问从\)(2,1)$ 出发 走到 \((2,m)\) 的方案数 \(mod 1e9 + 7\), 走的规则和限制如下: From the cell (i, j) you may advance to: (i - 1, j + 1) - only if i > 1, (i, j + 1), or (i + 1, j + 1) - only if i <…
A. water the garden Code #include <bits/stdc++.h> #define maxn 210 using namespace std; typedef long long LL; int n, k; int x[maxn]; void work() { scanf("%d%d", &n,&k); for (int i = 0; i < k; ++i) scanf("%d", &x[i]…
E. Connected Components? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an undirected graph consisting of n vertices and edges. Instead of giving you the edges that exist i…