Submission #19527

#TimeUsernameProblemLanguageResultExecution timeMemory
19527NamnamseoΣ (kriii4_P2)C++14
100 / 100
25 ms1716 KiB
#include <iostream> using namespace std; typedef long long ll; int M=int(1e9)+7; ll pow(ll a,ll b){ if(b==0) return 1; ll ret=pow(a,b/2); ret=(ret*ret)%M; if(b&1) ret=(ret*a)%M; return ret; } int main() { ll ret=0, tmp; int n; cin>>n; int a,b; for(;n--;){ cin>>a>>b; tmp=b*pow(a,M-2)%M; ret=(ret+tmp)%M; } cout<<ret; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...