# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
19636 |
2016-02-25T02:59:08 Z |
yongwhan |
Σ (kriii4_P2) |
C++ |
|
17 ms |
1720 KB |
#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 |
1 |
Correct |
17 ms |
1720 KB |
Output is correct |
2 |
Correct |
15 ms |
1720 KB |
Output is correct |
3 |
Correct |
13 ms |
1720 KB |
Output is correct |
4 |
Correct |
14 ms |
1720 KB |
Output is correct |
5 |
Correct |
14 ms |
1720 KB |
Output is correct |
6 |
Correct |
14 ms |
1720 KB |
Output is correct |
7 |
Correct |
13 ms |
1720 KB |
Output is correct |
8 |
Correct |
12 ms |
1720 KB |
Output is correct |
9 |
Correct |
15 ms |
1720 KB |
Output is correct |
10 |
Correct |
11 ms |
1720 KB |
Output is correct |
11 |
Correct |
11 ms |
1720 KB |
Output is correct |
12 |
Correct |
15 ms |
1720 KB |
Output is correct |
13 |
Correct |
12 ms |
1720 KB |
Output is correct |
14 |
Correct |
12 ms |
1720 KB |
Output is correct |
15 |
Correct |
11 ms |
1720 KB |
Output is correct |
16 |
Correct |
14 ms |
1720 KB |
Output is correct |
17 |
Correct |
9 ms |
1720 KB |
Output is correct |
18 |
Correct |
13 ms |
1720 KB |
Output is correct |
19 |
Correct |
14 ms |
1720 KB |
Output is correct |
20 |
Correct |
15 ms |
1720 KB |
Output is correct |