Submission #19313

#TimeUsernameProblemLanguageResultExecution timeMemory
19313imsifileΣ (kriii4_P2)C++98
100 / 100
8 ms1084 KiB
#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 timeMemoryGrader output
Fetching results...