# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19370 | ilbbke | Σ (kriii4_P2) | C++98 | 0 ms | 1084 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
#define M 1000000007
int m;
long long a,b;
long long back(int x,long long k){
long long t;
if(x==0) return 1;
if(x==1) return k;
if(x==2) return k*k;
t=back(x/2,k);
return x%2?t*t%M*k%M:t*t%M;
}
int main()
{
scanf("%d",&m);
int i;
long long x,y,s=0;
for(i=1;i<=m;i++){
scanf("%lld %lld",&b,&a);
x=back(M-2,b);
s=(s+(x*a)%M);
}
printf("%lld",s);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |