QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#279520#6957. Do You Like Interactive Problems?IsaacMoris#AC ✓1ms3504kbC++14606b2023-12-08 20:38:102023-12-08 20:38:10

Judging History

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

  • [2023-12-08 20:38:10]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3504kb
  • [2023-12-08 20:38:10]
  • 提交

answer

#include<iostream>
#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 30, mod = 998244353;

void doWork() {
    int n;
    cin >> n;

    if (n <= 2)cout << n - 1 << "\n";
    else {
        int inv = mod - 1ll * mod / 3 * (mod - mod / 2) % mod;
        cout << (2ll * n - 1) * inv % mod << "\n";
    }
}

int main() {
    IO
    int t = 1;
    cin >> t;
    for (int i = 1; i <= t; i++) {
        //  cout << "Case #" << i << ": ";
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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