QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#79679 | #3724. Strange Prime | Pure_Furies | WA | 257ms | 4256kb | C++14 | 321b | 2023-02-20 19:12:05 | 2023-02-20 19:12:07 |
Judging History
answer
#import<iostream>
using namespace std;
int p=1e9+7,w=p-51,n,m[100003],a[100003];
int main(){
m[0]=1;
while(cin>>n){
for(int i=1;i<=n;i++){
cin>>a[i];
m[i]=1ll*m[i-1]*(w+p-a[i])%p;
}
int ans=0,P=1;
for(int i=n;i;i--)
ans=(ans+P*m[i-1])%p,
P=(p-1ll)*P%p*a[i]%p;
cout<<ans<<'\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 257ms
memory: 4256kb
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:
172050615 -397229113 429426093 365185911 885216606 564597597 924237412 903028429 782945802 407818807 65170043 169356987 280729432 236047076 52070836 469814654 498368646 -44653973 916523271 645438419 430814438 679421448 -113168674 -62101271 799322360 717436332 851413851 -199674559 -880477743 -2439392...
result:
wrong answer 1st numbers differ - expected: '8747181', found: '172050615'