Submission #19357

#TimeUsernameProblemLanguageResultExecution timeMemory
19357algoshipdaΣ (kriii4_P2)C++14
100 / 100
17 ms1720 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lld; const int MOD = 1e9 + 7; int fpow(int n, int k) { if(k == 0) return 1; if(k % 2){ return 1ll * n * fpow(n, k - 1) % MOD; } int h = fpow(n, k / 2); return 1ll * h * h % MOD; } int inv(int n) { return 1ll * fpow(n, MOD - 2) % MOD; } int main() { int t; cin >> t; int s = 0; while(t--){ int n, k; cin >> k >> n;; s += 1ll * n * inv(k) % MOD; s %= MOD; } cout << s << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...