QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#387731#3740. 2018rukongAC ✓39ms35248kbC++17567b2024-04-12 18:55:112024-04-12 18:55:13

Judging History

This is the latest submission verdict.

  • [2024-04-12 18:55:13]
  • Judged
  • Verdict: AC
  • Time: 39ms
  • Memory: 35248kb
  • [2024-04-12 18:55:11]
  • Submitted

answer

#include<iostream>
#include<algorithm>
#include<math.h>
#include<map>
#include<string.h>
#include<queue>
#define int long long
#define endl "\n";
using namespace std;
int a[2005][2005];
int x,y;
const int m=1e9+7;
signed main()
{
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	for(int i=1;i<=2000;i++)
	{
		a[i][1]=a[1][i]=i;
		a[i][0]=0;
	}
	for(int i=2;i<=2000;i++)
	for(int j=2;j<=2000;j++)
	{
		a[i][j]=a[i][j-1]*2+a[i-1][j]-a[i][j-2]-a[i-1][j-1];
		a[i][j]%=m;
	}
	while(scanf("%lld%lld",&x,&y)!=EOF)
	{
		printf("%lld\n",(a[x][y]*a[x][y])%m);
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 39ms
memory: 35248kb

input:

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10
2 11
2 12
2 13
2 1...

output:

1
4
9
16
25
36
49
64
81
100
121
144
169
196
225
256
289
324
361
400
441
484
529
576
625
676
729
784
841
900
961
1024
1089
1156
1225
1296
1369
1444
1521
1600
1681
1764
1849
1936
2025
2116
2209
2304
2401
2500
4
25
81
196
400
729
1225
1936
2916
4225
5929
8100
10816
14161
18225
23104
28900
35721
43681
5...

result:

ok 100000 numbers