QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#197777 | #6957. Do You Like Interactive Problems? | PPP# | AC ✓ | 0ms | 3552kb | C++17 | 1.1kb | 2023-10-02 19:45:49 | 2023-10-02 19:45:49 |
Judging History
answer
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int mod = 998244353;
int mult(int a, int b) {
return (1LL * a * b) % mod;
}
int sum(int a, int b) {
int s = a + b;
if (s >= mod) s -= mod;
return s;
}
int pw(int a, int b) {
if (b == 0) return 1;
if (b & 1) return mult(a, pw(a, b - 1));
int res = pw(a, b / 2);
return mult(res, res);
}
int sub(int a, int b) {
int s = a - b;
if (s < 0) s += mod;
return s;
}
const int inv3 = pw(3, mod - 2);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#ifdef DEBUG
freopen("input.txt", "r", stdin);
#endif
int tst;
cin >> tst;
while (tst--) {
int n;
cin >> n;
if (n == 1) {
cout << 0 << '\n';
}
else {
n %= mod;
n = sub(n, 2);
n = mult(n, 2);
n = mult(n, inv3);
cout << sum(n, 1) << '\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
100 251608761 33782011 325968940 486286497 999999993 575267221 8 928380304 123861349 739740016 999999991 31193142 9 999999996 705831120 162816569 293889735 644068367 999999992 1 323447272 387107234 6 214616549 755303220 699413097 499430423 151674815 999999998 46590460 2486352 926437790 248790470 100...
output:
833235409 355269458 550060744 989687233 333918544 716259598 5 951668320 415322350 825908128 1170425 686291663 665496241 333918546 137805962 108544379 861422725 429378911 666666661 0 548379632 258071489 665496239 143077699 170787362 133527280 332953615 101116543 666666665 363808424 667153803 61762519...
result:
ok 100 lines