# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19636 | yongwhan | Σ (kriii4_P2) | C++98 | 17 ms | 1720 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<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
ll exp(ll a, ll b, ll m) {
ll r=1;
while(b) {
if(b%2) r=(r*a)%m;
a=(a*a)%m;
b/=2;
}
return r;
}
ll inv(ll a, ll m) {
return exp(a,m-2,m);
}
int main() {
int m; cin>>m;
ll ret=0;
for (int i=0; i<m; i++) {
ll n,s; cin>>n>>s;
ret=(ret+s*inv(n,mod))%mod;
}
cout << ret << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |