# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19411 | Qwaz | Σ (kriii4_P2) | C++14 | 7 ms | 1084 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 <cstdio>
typedef long long ll;
const int MOD = 1000000007;
ll modpow(ll a, ll x) {
ll ret = 1;
a = a % MOD;
while (x) {
if (x & 1) ret = ret * a % MOD;
a = a * a % MOD;
x >>= 1;
}
return ret;
}
int main() {
int n;
scanf("%d", &n);
ll res = 0;
for (int i = 0; i < n; i++) {
int a, b;
scanf("%d%d", &a, &b);
res = (res + b * modpow(a, MOD-2)) % MOD;
}
printf("%lld\n", res);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |