Submission #19620

#TimeUsernameProblemLanguageResultExecution timeMemory
19620javelinsmanΣ (kriii4_P2)C++14
100 / 100
19 ms1716 KiB
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; const ll MOD = 1e9+7; ll go(int x,int y){ x%=MOD; if(y==0) return 1; if(y==1) return x; if(y%2) return go(x,y-1)*x%MOD; ll h = go(x,y/2); return h*h%MOD; } int main(){ int m; cin>>m; ll ans = 0; while(m--){ ll a,b; cin>>b>>a; ans = (ans + ((a%MOD)*go(b,MOD-2))%MOD)%MOD; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...