QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#88774 | #4819. Just Another Number Theory Problem | Olegpresnyakov | WA | 2ms | 3472kb | C++14 | 1.8kb | 2023-03-17 10:05:04 | 2023-03-17 10:05:08 |
Judging History
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
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;
}
sum += ans;
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();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3348kb
input:
2 2 5
output:
18
result:
ok 1 number(s): "18"
Test #2:
score: 0
Accepted
time: 2ms
memory: 3372kb
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: 2ms
memory: 3376kb
input:
2 5 23
output:
535
result:
ok 1 number(s): "535"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3372kb
input:
3 2 3 5
output:
46
result:
ok 1 number(s): "46"
Test #6:
score: 0
Accepted
time: 2ms
memory: 3472kb
input:
4 3 5 7 59
output:
13473
result:
ok 1 number(s): "13473"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3324kb
input:
5 3 11 17 19 53
output:
1398057
result:
ok 1 number(s): "1398057"
Test #8:
score: 0
Accepted
time: 1ms
memory: 3400kb
input:
6 3 7 11 13 17 19
output:
2051859
result:
ok 1 number(s): "2051859"
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3336kb
input:
6 23 29 31 41 43 47
output:
642363440
result:
wrong answer 1st numbers differ - expected: '248098855', found: '642363440'