QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#88776#4819. Just Another Number Theory ProblemOlegpresnyakovWA 2ms3476kbC++141.9kb2023-03-17 10:07:592023-03-17 10:08:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-17 10:08:01]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3476kb
  • [2023-03-17 10:07:59]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <fstream>
#include<time.h>
#include <unordered_map>
#include <cstdlib>
#include <string.h>
#include <bitset>
#include <unordered_set>
#include <cstdlib>
#include <cassert>
#include <queue>

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i < (n); ++i)
#define rep1n(i, n) for(int i = 1; i <= (n); ++i)
#define repr(i, n) for(int i = (n) - 1; i >= 0; --i)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(a) (int)(a.size())
#define each(x, a) for(auto &x : a)
#define ar array
#define int long long
 
using namespace std;
 
int Bit(int mask, int b) { return (mask >> b) & 1; }
 
template<class T> bool ckmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T> bool ckmax(T &a, const T &b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}

//__builtin_popcount = int
//__builtin_popcountl = long int
//__builtin_popcountll = long long

const int mod = 998244353;

void solve(){
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i = 0; i < n; ++i){
        cin >> p[i];
    }

    int sum = 0;
    for(int i = 0; i <= p[0] - 1; ++i){
        int ans = 1 + (i > 0 ? 1 : 0);
        for(int j = 0; j < n; ++j){
            ans *= (p[j] - i);
            ans %= mod;
            ans += mod;
            ans %= mod;
        }

        sum += ans;
        sum %= mod;
        sum += mod;
        sum %= mod;
    }

    cout << sum << "\n";
}

signed main(){
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int t = 1;
    while(t--) {
        solve();
    }
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3344kb

input:

2
2 5

output:

18

result:

ok 1 number(s): "18"

Test #2:

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

input:

3
5 7 233

output:

31275

result:

ok 1 number(s): "31275"

Test #3:

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

input:

1
3

output:

9

result:

ok 1 number(s): "9"

Test #4:

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

input:

2
5 23

output:

535

result:

ok 1 number(s): "535"

Test #5:

score: 0
Accepted
time: 2ms
memory: 3316kb

input:

3
2 3 5

output:

46

result:

ok 1 number(s): "46"

Test #6:

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

input:

4
3 5 7 59

output:

13473

result:

ok 1 number(s): "13473"

Test #7:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

5
3 11 17 19 53

output:

1398057

result:

ok 1 number(s): "1398057"

Test #8:

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

input:

6
3 7 11 13 17 19

output:

2051859

result:

ok 1 number(s): "2051859"

Test #9:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

6
23 29 31 41 43 47

output:

248098855

result:

ok 1 number(s): "248098855"

Test #10:

score: 0
Accepted
time: 2ms
memory: 3476kb

input:

8
2 3 7 11 19 29 41 43

output:

652005606

result:

ok 1 number(s): "652005606"

Test #11:

score: 0
Accepted
time: 2ms
memory: 3420kb

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: 3424kb

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: 1ms
memory: 3372kb

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: 2ms
memory: 3468kb

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: 1ms
memory: 3404kb

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: 1ms
memory: 3404kb

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: 2ms
memory: 3324kb

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: 2ms
memory: 3404kb

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: 0ms
memory: 3352kb

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: 1ms
memory: 3472kb

input:

2
83 831515409522078991

output:

130479215

result:

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