Submission #19338

#TimeUsernameProblemLanguageResultExecution timeMemory
19338gs13068Σ (kriii4_P2)C++98
100 / 100
6 ms1084 KiB
#include <cstdio> const int p = 1000000007; int f(int x, int y) { return y & 1 ? (long long)f(x, y ^ 1)*x%p : y ? f((long long)x*x%p, y >> 1) : 1; } int main() { int n, a, b, r = 0; scanf("%d", &n); while (n--) { scanf("%d%d", &a, &b); r = (r + (long long)f(a, p - 2)*b) % p; } printf("%d", r); }
#Verdict Execution timeMemoryGrader output
Fetching results...