ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#204548 | #3615. 数糖果 | BXW | 100 | 421ms | 24628kb | C++ | 558b | 2024-06-02 09:36:44 | 2024-06-02 12:07:02 |
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,a,b,c,f[3000020];
const int mod=1000000007;
int kasumi(int x,int y){
int re=1;
while(y){
if(y&1) re=re*x%mod;
x=x*x%mod;
y>>=1;
}
return re;
}
signed main(){
f[0]=1;
for(int i=1;i<=3000000;i++) f[i]=f[i-1]*i%mod;
scanf("%d",&t);
while(t--){
scanf("%d%d%d",&a,&b,&c);
if(abs(b-c)>2||b==c){
puts("0");
continue;
}
printf("%d\n",f[b]*f[c]%mod*f[b+c+a-1]%mod*kasumi(f[b+c-1],mod-2)%mod);
}
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 15ms
memory: 24624kb
input:
5 3 1 3 5 2 3 5 6 4 5 6 4 4 4 3
output:
720 181440 151347172 151347172 725760
result:
ok 5 lines
Test #2:
score: 10
Accepted
time: 17ms
memory: 24620kb
input:
5 5 5 3 2 4 2 3 5 3 1 1 2 4 4 2
output:
68428800 2016 518400 6 145152
result:
ok 5 lines
Test #3:
score: 10
Accepted
time: 19ms
memory: 24620kb
input:
5 2 3 1 1 2 4 3 4 3 5 3 2 5 3 1
output:
120 288 72576 181440 40320
result:
ok 5 lines
Test #4:
score: 10
Accepted
time: 3ms
memory: 24628kb
input:
300 288 168 170 157 66 68 4 150 148 196 243 244 180 146 148 46 203 205 290 11 12 220 177 176 21 137 ...
output:
947653602 533474068 507308393 125596329 164337320 60882520 452533043 401891273 291500104 697851533 4...
result:
ok 300 lines
Test #5:
score: 10
Accepted
time: 24ms
memory: 24628kb
input:
300 70 165 163 141 44 42 44 202 204 13 158 156 125 9 11 217 20 18 50 263 262 198 105 103 133 300 298...
output:
608459872 837718974 203852844 565805161 639798107 241747747 923610631 930603776 187433271 890387297 ...
result:
ok 300 lines
Test #6:
score: 10
Accepted
time: 13ms
memory: 24624kb
input:
300 48 110 109 33 237 236 292 256 258 122 120 121 266 254 255 200 299 300 111 296 297 169 164 162 37...
output:
186941209 100690166 900205206 47018857 293780807 758472925 337160787 477866808 452308288 738416547 5...
result:
ok 300 lines
Test #7:
score: 10
Accepted
time: 76ms
memory: 24628kb
input:
100000 135340 204749 204751 578020 673158 673159 682787 143339 143338 565257 348497 348495 236412 34...
output:
447249095 716600114 556651949 2467060 205167072 801789309 873483847 30641807 670250900 276575591 300...
result:
ok 100000 lines
Test #8:
score: 10
Accepted
time: 84ms
memory: 24624kb
input:
100000 764818 160867 160869 762008 515808 515809 209826 896991 896992 13174 48146 48147 500653 49016...
output:
294005921 470269560 395930390 810321885 293666994 419290596 757000037 254858646 502033465 622760212 ...
result:
ok 100000 lines
Test #9:
score: 10
Accepted
time: 77ms
memory: 24624kb
input:
100000 394295 631191 631189 978700 844255 844253 769570 136441 136443 461091 251615 251614 797598 13...
output:
916590405 125819448 198990209 652797416 907226043 29769427 360175978 141717526 858105718 267726715 9...
result:
ok 100000 lines
Test #10:
score: 10
Accepted
time: 93ms
memory: 24624kb
input:
100000 23773 587309 587308 354176 686904 686905 105122 861685 861687 909008 951263 951265 837647 282...
output:
954450525 14529932 516288037 535066063 25282558 253150829 293662444 178345066 29893834 180424456 963...
result:
ok 100000 lines
Extra Test:
score: 0
Extra Test Passed