Submission #1076842


Source Code Expand

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 2005
#define M 200005
#define seed 23333

using namespace std;
const int Mo=(int)1e9+7;
int i,j,m,n,p,K,f[N*2][N*2],ans,k;
void jia(int &x,int y)
{
		x+=y; if (x>=Mo) x-=Mo;
}
int main()
{
		scanf("%d%d%d",&n,&m,&K);
		f[0][0]=1;
		for (i=1;;++i)
		{
			if (i*(K-1)>(n+m-1)) break;
			for (j=0;j<=(K-1)*(i-1)&&j<=n;++j)
				if (f[i-1][j])
				{
					for (k=1;k<K&&j+k<=n;++k)
					{
							int now=j+k;
							if (i*(K-1)-now<=m-1&&now%(K-1)==n%(K-1)&&(i*(K-1)-now)%(K-1)==(m-1)%(K-1)) 
							jia(ans,f[i-1][j]);
					}
					for (k=0;k<K&&j+k<=n;++k)
						jia(f[i][j+k],f[i-1][j]);
				}
		}
		printf("%d\n",ans);
}

Submission Info

Submission Time
Task E - Eternal Average
User qiaoranliqu
Language C++14 (GCC 5.4.1)
Score 1600
Code Size 991 Byte
Status AC
Exec Time 174 ms
Memory 39680 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:33:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%d",&n,&m,&K);
                           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1600 / 1600
Status
AC × 3
AC × 27
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 3 ms 256 KB
02.txt AC 174 ms 39680 KB
03.txt AC 3 ms 256 KB
04.txt AC 3 ms 256 KB
05.txt AC 110 ms 19968 KB
06.txt AC 7 ms 2944 KB
07.txt AC 21 ms 4224 KB
08.txt AC 4 ms 512 KB
09.txt AC 58 ms 1536 KB
10.txt AC 55 ms 1152 KB
11.txt AC 16 ms 256 KB
12.txt AC 7 ms 256 KB
13.txt AC 42 ms 640 KB
14.txt AC 21 ms 384 KB
15.txt AC 38 ms 640 KB
16.txt AC 3 ms 256 KB
17.txt AC 22 ms 256 KB
18.txt AC 13 ms 640 KB
19.txt AC 58 ms 17280 KB
20.txt AC 64 ms 5888 KB
21.txt AC 3 ms 256 KB
22.txt AC 74 ms 5120 KB
23.txt AC 43 ms 896 KB
24.txt AC 38 ms 768 KB
s1.txt AC 3 ms 256 KB
s2.txt AC 3 ms 256 KB
s3.txt AC 3 ms 384 KB