QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#196216#6956. Many Topological Problemsyiyiyi#WA 49ms3696kbC++14671b2023-10-01 14:10:592023-10-01 14:11:00

Judging History

你现在查看的是最新测评结果

  • [2023-10-01 14:11:00]
  • 评测
  • 测评结果:WA
  • 用时:49ms
  • 内存:3696kb
  • [2023-10-01 14:10:59]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f
#define re register
#define N 1020030
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int mo=1000000007;
inline int read(){
	int x=0,w=0;char ch=getchar();
	while (!isdigit(ch))w|=ch=='-',ch=getchar();
	while (isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return w?-x:x;
}

void solve(){
	int n=read(),k=read(),ans=1;
	for (int i=1;i<=k;++i)ans=ans*i%mo;
	for (int i=1;i<=n;++i)ans=ans*i%mo;
	for (int i=1;i<=n-k-1;++i)ans=ans*k%mo;
	cout<<ans<<endl;		
}
signed main(){
    int T=read();
    while (T--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 49ms
memory: 3696kb

input:

10
1 1
700503 623646
939811 584922
752155 569391
348265 116258
839298 839298
800391 216447
150847 116426
370812 168588
1000000 407619

output:

1
972550684
617838838
561525568
470024873
928010627
782371500
133886363
868118624
262962652

result:

wrong answer 6th lines differ - expected: '910196299', found: '928010627'