Submission #1180302
Source Code Expand
#include<bits/stdc++.h> #define N 2005 using namespace std; const int mo=1e9+7; int n,m,k,S,f[N][N],ans; void inc(int &x,int y){ x=x+y>=mo ? x+y-mo : x+y;} void dec(int &x,int y){ x=x-y<0 ? x-y+mo : x-y;} int main() { int i,j; cin>>n>>m>>k; f[0][0]=1; for(i=1;i<=2000;i++){ S=0; for(j=0;j<=m;j++){ if(j>=k) dec(S,f[i-1][j-k]); if(j%(k-1)==m%(k-1)&&(k-1)*i-j<=n-1&&((k-1)*i-j)%(k-1)==(n-1)%(k-1)) inc(ans,S); inc(S,f[i-1][j]); inc(f[i][j],S); } } cout<<ans; return 0; }
Submission Info
Submission Time | |
---|---|
Task | E - Eternal Average |
User | MemorySlices |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 527 Byte |
Status | WA |
Exec Time | 50 ms |
Memory | 15872 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 5 ms | 14208 KB |
02.txt | WA | 50 ms | 15872 KB |
03.txt | AC | 5 ms | 14208 KB |
04.txt | AC | 4 ms | 14208 KB |
05.txt | AC | 36 ms | 15872 KB |
06.txt | AC | 29 ms | 15872 KB |
07.txt | AC | 4 ms | 14208 KB |
08.txt | AC | 13 ms | 15360 KB |
09.txt | AC | 28 ms | 15872 KB |
10.txt | AC | 29 ms | 15872 KB |
11.txt | AC | 24 ms | 15872 KB |
12.txt | AC | 22 ms | 15872 KB |
13.txt | AC | 28 ms | 15872 KB |
14.txt | AC | 19 ms | 15872 KB |
15.txt | AC | 28 ms | 15872 KB |
16.txt | AC | 10 ms | 15232 KB |
17.txt | AC | 21 ms | 15872 KB |
18.txt | AC | 27 ms | 15872 KB |
19.txt | WA | 7 ms | 14464 KB |
20.txt | AC | 25 ms | 15872 KB |
21.txt | AC | 5 ms | 14208 KB |
22.txt | AC | 28 ms | 15872 KB |
23.txt | AC | 25 ms | 15872 KB |
24.txt | AC | 25 ms | 15872 KB |
s1.txt | AC | 5 ms | 14208 KB |
s2.txt | AC | 5 ms | 14208 KB |
s3.txt | AC | 6 ms | 14464 KB |