QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#158823 | #5681. Caravan Trip Plans | acm202226010311 | WA | 1ms | 3720kb | C++14 | 552b | 2023-09-02 17:03:56 | 2023-09-02 17:03:57 |
Judging History
answer
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
long long C(int n, int m)
{
if (m < n - m) m = n - m;
long long ans = 1;
for (int i = m + 1; i <= n; i++) ans = 1ll*ans*i;
for (int i = 1; i <= n - m; i++) ans /= i;
return ans;
}
int main()
{
int n,k;
cin>>n>>k;
int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
while(k--)
{
long long int res=0;
int end,all;
cin>>end>>all;
for(int j=0;j<=all-arr[end-1];j++)
{
res+=C(j+end-1,end-1);
}
cout<<res<<endl;
}
return 0;}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3712kb
input:
5 1 2 3 5 7 11 3 7
output:
10
result:
ok single line: '10'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
8 3 2 3 5 7 11 13 17 19 3 7 5 15 8 24
output:
10 126 1287
result:
ok 3 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
15 5 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 7 23 10 35 4 14 5 23 15 56
output:
1716 8008 330 6188 1307504
result:
ok 5 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
20 5 3 5 8 10 13 15 18 20 23 25 28 30 33 35 38 40 43 45 48 50 5 23 7 25 13 39 16 50 20 59
output:
3003 3432 27132 5311735 10015005
result:
ok 5 lines
Test #5:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
20 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 10 3 7 15 20 20 25 11 18
output:
120 35 15504 53130 31824
result:
ok 5 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
20 5 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 5 15 12 29 8 19 15 40 20 50
output:
252 6188 165 3268760 30045015
result:
ok 5 lines
Test #7:
score: -100
Wrong Answer
time: 1ms
memory: 3556kb
input:
20 5 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 20 60 19 60 18 60 17 60 16 60
output:
539367114 388688558 261608058 57426432 120843906
result:
wrong answer 1st lines differ - expected: '137846528820', found: '539367114'