QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#47169#4626. Sum Plus ProductCDsmenAC ✓1ms3700kbC++171.2kb2022-09-04 13:40:452022-09-04 13:40:47

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-04 13:40:47]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3700kb
  • [2022-09-04 13:40:45]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define endl '\n'
//define int __int128

using namespace std;

typedef pair<int,int> PII;
typedef long long int llint;
const llint mod=998244353;
const int inf=0x3f3f3f3f;
const llint INF=0x3f3f3f3f3f3f3f3f;

inline int read(){
    int ans=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){ans=ans*10+ch-'0';ch=getchar();}
    return ans*w;
}



inline void solve(){
    int n=read();
    llint ans=1;
    for(int i=0;i<n;i++){
        int x=read();
        ans=ans*(x+1LL)%mod;
    }
    cout<<(ans-1+mod)%mod<<endl;
}

int main()
{
    //IO;
    int tt=1;
    tt=read();
    //cin>>tt;
    while(tt--){
        solve();
    }
}


/*
struct D{
    int to,next;
}edge[200005];
int head[100005]={0},tot=1;
inline void adde(int u,int v){
    edge[tot]={v,head[u]};
    head[u]=tot++;
}
*/
/*
void print(__int128 x)
{
    if(x>=10)
    {
        print(x/10);
        cout << (int)(x%10);
    }
    if(x<10)
    {
        cout << (int)(x);
        return ;
    }
}
*/


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

20
500
732119 592443 487799 985235 815368 743444 295 298638 775259 682852 582519 959745 58200 894834 569370 811779 934590 894530 62915 824557 788216 907951 676664 158503 712163 916901 419672 787605 772426 781424 54232 249035 937144 397358 513471 866695 905096 196496 757032 651037 313683 13446 892474...

output:

114197416
917043234
544093214
401121933
778909293
664748218
176577148
573588739
287522182
393491771
106995199
907165620
901896328
869872965
856266924
464500410
563224721
217487082
379371271
77123502

result:

ok 20 lines