B. Modulo Sum                                                                                                  time limit per test 2 seconds                                                    …
B. Modulo Sum Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/577/problem/B Description You are given a sequence of numbers a1, a2, ..., an, and a number m. Check if it is possible to choose a non-empty subsequence aij such…
B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a sequence of numbers a1, a2, ..., an, and a number m. Check if it is possible to choose a non-empty subsequence…
直接O(n*m)的dp也可以直接跑过. 因为上最多跑到m就终止了,因为前缀sum[i]取余数,i = 0,1,2,3...,m,有m+1个余数,m的余数只有m种必然有两个相同. #include<bits/stdc++.h> using namespace std; ; int cnt[maxn]; bool dp[maxn][maxn]; #define Y { puts("YES"); return 0; } int main() { //freopen("i…
Problem  Codeforces Round #556 (Div. 2) - D. Three Religions Time Limit: 1000 mSec Problem Description Input Output Sample Input 51 2 1 2 1 Sample Output 1 1 1 2 2 题解:这个题有做慢了,这种题做慢了和没做出来区别不大... 读题的时候脑子里还意识到素数除了2都是奇数,读完之后就脑子里就只剩欧拉筛了,贪心地构造使得前缀和是连续的素数,那…
Div. 2 Multiplication Table (577A) 题意: 给定n行n列的方阵,第i行第j列的数就是i*j,问有多少个格子上的数恰为x. 1<=n<=10^5, 1<=x<=10^9 题解: 送分题…对于每一行,判断是否存在数x即可…也可以枚举x的因子判断是否出现在表内… 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <cstdio> #include <cstring> inline in…
水 A - Multiplication Table 不要想复杂,第一题就是纯暴力 代码: #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int main(void) { int n, x; scanf (&qu…
C. Writing Code time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Programmers working on a large project have just received a task to write exactly m lines of code. There are n programmers w…
C. Running Track 题目连接: http://www.codeforces.com/contest/615/problem/C Description A boy named Ayrat lives on planet AMI-1511. Each inhabitant of this planet has a talent. Specifically, Ayrat loves running, moreover, just running is not enough for hi…
题目链接:http://codeforces.com/contest/283/problem/B 思路: dp[now][flag]表示现在在位置now,flag表示是接下来要做的步骤,然后根据题意记忆化搜索记忆,vis数组标记那些已经访问过的状态. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define REP(i, a, b) for (i…