# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19313 | imsifile | Σ (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 lld;
lld a, b, sum;
lld exp(lld a, lld b){
if(b==0)return 1;
lld k=exp(a, b/2);
k=(k*k)%mod;
if(b%2)k=(k*a)%mod;
return k;
}
int main(){
int n, i;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%lld%lld", &a, &b), a=exp(a,mod-2);
sum = (sum + a*b)%mod;
}
printf("%lld", sum);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |