Submission #1441689
Source Code Expand
#include<bits/stdc++.h> using namespace std; int ans, N, M, K, dp[4017][4017]; const int mod = 1e9 + 7; void adto (int &x, int y) {x += y; if (x >= mod) x -= mod;} int main () { scanf ("%d %d %d", &N, &M, &K), M --; for (int j=1; j<K; j++) dp[1][j] = 1; for (int i=2; i * (K - 1) <= N + M; i++) for (int j=0; j<=N + M; j++) for (int k=0; k<=j && k<K; k++) adto (dp[i][j], dp[i - 1][j - k]); for (int Q=1; Q * (K - 1) <= N + M; Q++) for (int S=1; S<=N; S++) if (S % (K - 1) == N % (K - 1) && Q * (K - 1) >= S && Q * (K - 1) - S <= M) adto (ans, dp[Q][S]); printf ("%d\n", ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Eternal Average |
User | geniucos |
Language | C++14 (GCC 5.4.1) |
Score | 1600 |
Code Size | 670 Byte |
Status | AC |
Exec Time | 148 ms |
Memory | 62976 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:12:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf ("%d %d %d", &N, &M, &K), M --; ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1600 / 1600 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 148 ms | 62976 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 95 ms | 33024 KB |
06.txt | AC | 19 ms | 12032 KB |
07.txt | AC | 23 ms | 7936 KB |
08.txt | AC | 4 ms | 768 KB |
09.txt | AC | 57 ms | 2304 KB |
10.txt | AC | 55 ms | 1664 KB |
11.txt | AC | 22 ms | 256 KB |
12.txt | AC | 15 ms | 256 KB |
13.txt | AC | 44 ms | 768 KB |
14.txt | AC | 21 ms | 384 KB |
15.txt | AC | 41 ms | 768 KB |
16.txt | AC | 1 ms | 256 KB |
17.txt | AC | 24 ms | 384 KB |
18.txt | AC | 21 ms | 1280 KB |
19.txt | AC | 49 ms | 34560 KB |
20.txt | AC | 55 ms | 10496 KB |
21.txt | AC | 1 ms | 256 KB |
22.txt | AC | 71 ms | 8448 KB |
23.txt | AC | 43 ms | 1408 KB |
24.txt | AC | 40 ms | 1152 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |
s3.txt | AC | 1 ms | 384 KB |