# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19564 | suzy | Σ (kriii4_P2) | C++98 | 8 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 MOD 1000000007
typedef long long lli;
lli p(lli b, lli x) {
if(x==0) return 1;
if(x%2) return b*p(b,x-1)%MOD;
else { lli m=p(b,x/2); return m*m%MOD; }
}
lli f(lli a, lli b) {
return a*p(b,MOD-2)%MOD;
}
int main() {
int m;
scanf("%d",&m);
lli res=0;
while(m--) {
lli n, s;
scanf("%lld %lld",&n,&s);
res+=f(s,n); res%=MOD;
}
printf("%lld",res);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |