QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#79714 | #3724. Strange Prime | xzzduang | WA | 43ms | 5168kb | C++14 | 1.1kb | 2023-02-20 19:32:00 | 2023-02-20 19:32:02 |
Judging History
answer
#include<iostream>
#include<stdio.h>
#include<ctype.h>
#define ll long long
#define ld long double
#define fi first
#define se second
#define pii pair<int,int>
#define lowbit(x) ((x)&-(x))
#define popcount(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define umap unordered_map
#define all(x) x.begin(),x.end()
#define mk make_pair
#define pb push_back
#define ckmax(x,y) x=max(x,y)
#define ckmin(x,y) x=min(x,y)
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define N 100005
#define int long long
using namespace std;
inline int read(){
int x=0,f=0; char ch=getchar();
while(!isdigit(ch)) f|=(ch==45),ch=getchar();
while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
return f?-x:x;
}
const int mo=1e9+7,P=1e10+19;
inline void red(int &x){x>=mo?x-=mo:0;}
int n,a[N],ans,pre[N];
signed main(){
while(scanf("%lld",&n)!=EOF){
ans=0;
pre[0]=1;
for(int i=1;i<=n;++i) a[i]=read(),pre[i]=pre[i-1]*a[i]%mo;
int mul=1;
for(int i=n;i>=1;--i){
red(ans+=mul*pre[i-1]%mo);
mul=(P-a[i])%mo*mul%mo;
}
printf("%lld\n",ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 43ms
memory: 5168kb
input:
10 2357 42596 7212 30898 43465 68984 60783 59520 53767 77560 10 39115 88080 83553 61736 90821 39690 13194 81396 38051 55993 10 95070 81321 71632 21071 10807 46105 66844 63678 47577 75132 10 43898 93215 26791 11849 61857 1423 76971 83489 52044 61325 10 22610 16613 90 53598 80110 42651 64942 67114 242...
output:
276401514 528736719 55645786 692739712 729536373 236372323 601105518 309268671 457244178 786462261 90450986 90480167 109428708 944184730 435219909 14890958 279437288 487848867 785869925 153762111 507868257 249387649 843820333 91930607 699270414 951698441 611414215 759725062 690092296 265618089 65639...
result:
wrong answer 1st numbers differ - expected: '8747181', found: '276401514'