QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#405453#4819. Just Another Number Theory ProblemxuzhihaodedieWA 1ms3656kbC++20691b2024-05-05 23:06:542024-05-05 23:06:55

Judging History

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

  • [2024-05-05 23:06:55]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3656kb
  • [2024-05-05 23:06:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PII pair<int,int>
#define lson 2*p
#define rson 2*p+1
#define x first
#define y second
//#define endl "\n"
constexpr int N=2e5+10;
constexpr int mod=998244353;
int p[N];
void solve() {
    int n;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>p[i];
    int ans=0;
    for(int i=0;i<p[1];i++) {
        int res=1;
        if(i) res++;
        for(int j=1;j<=n;j++) res=res*(p[j]-i)%mod;
        ans+=res;
    }
    ans%=mod;
    cout<<ans<<endl;
}
signed main() {
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    int T=1;
    //cin>>T;
    while(T--) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3472kb

input:

2
2 5

output:

18

result:

ok 1 number(s): "18"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

3
5 7 233

output:

31275

result:

ok 1 number(s): "31275"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

1
3

output:

9

result:

ok 1 number(s): "9"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

2
5 23

output:

535

result:

ok 1 number(s): "535"

Test #5:

score: 0
Accepted
time: 1ms
memory: 3528kb

input:

3
2 3 5

output:

46

result:

ok 1 number(s): "46"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

4
3 5 7 59

output:

13473

result:

ok 1 number(s): "13473"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

5
3 11 17 19 53

output:

1398057

result:

ok 1 number(s): "1398057"

Test #8:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

6
3 7 11 13 17 19

output:

2051859

result:

ok 1 number(s): "2051859"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

6
23 29 31 41 43 47

output:

248098855

result:

ok 1 number(s): "248098855"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

8
2 3 7 11 19 29 41 43

output:

652005606

result:

ok 1 number(s): "652005606"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

9
3 5 11 13 17 19 29 47 53

output:

639137187

result:

ok 1 number(s): "639137187"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3464kb

input:

10
2 7 23 29 37 41 47 53 59 67

output:

741639722

result:

ok 1 number(s): "741639722"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

10
7 11 17 29 31 37 41 47 53 79

output:

130554824

result:

ok 1 number(s): "130554824"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

20
2 7 17 23 29 31 37 83 89 101 103 109 113 127 131 137 139 149 163 199

output:

617707828

result:

ok 1 number(s): "617707828"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

30
2 5 7 17 23 31 37 41 43 59 73 83 103 109 113 139 149 151 173 197 211 227 229 233 251 257 269 271 281 293

output:

42172932

result:

ok 1 number(s): "42172932"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3444kb

input:

50
2 23 29 37 41 43 53 67 83 89 97 109 113 137 139 149 151 157 173 179 181 191 197 199 223 233 239 241 251 269 281 283 293 307 313 331 337 347 353 359 367 373 389 397 409 457 461 463 467 479

output:

713703182

result:

ok 1 number(s): "713703182"

Test #17:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

100
2 3 7 17 19 23 43 47 79 83 101 109 149 151 163 167 193 233 257 263 293 307 311 317 331 421 461 463 467 491 557 617 631 653 673 719 827 911 953 1013 1021 1031 1049 1063 1097 1103 1109 1117 1181 1201 1217 1249 1259 1301 1303 1307 1327 1489 1499 1567 1627 1657 1667 1723 1747 1759 1787 1831 1877 190...

output:

69515875

result:

ok 1 number(s): "69515875"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

200
31 43 53 59 61 67 83 97 103 107 137 163 167 241 359 389 479 593 601 683 701 733 769 797 863 883 887 991 1039 1093 1123 1151 1163 1229 1237 1301 1321 1327 1429 1481 1531 1543 1619 1621 1627 1637 1759 1811 1873 1877 1907 1949 1993 2027 2053 2063 2087 2099 2113 2129 2143 2221 2333 2347 2357 2381 24...

output:

319856386

result:

ok 1 number(s): "319856386"

Test #19:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

100
13 119363 147661 163981 182681 275161 330697 336829 418637 433847 460903 649619 675239 770993 877399 1121699 1136617 1232171 1353679 1426157 1470067 1781693 1849933 1967369 2228081 2243077 2279153 2407231 2611663 2903633 2938241 3158167 3256313 3501209 3524243 3575251 3679211 3898463 4048229 406...

output:

864286417

result:

ok 1 number(s): "864286417"

Test #20:

score: -100
Wrong Answer
time: 0ms
memory: 3588kb

input:

2
83 831515409522078991

output:

130479215

result:

wrong answer 1st numbers differ - expected: '573953298', found: '130479215'