Submission #19301

#TimeUsernameProblemLanguageResultExecution timeMemory
19301cki86201Σ (kriii4_P2)C++98
100 / 100
6 ms1720 KiB
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> using namespace std; typedef long long ll; typedef pair<int, int> Pi; #define Fi first #define Se second #define pb(x) push_back(x) #define sz(x) (int)x.size() #define rep(i,n) for(int i=0;i<n;i++) #define all(x) x.begin(),x.end() const ll MOD = 1e9 + 7; ll pw(ll a,ll b){ a %= MOD; ll res = 1; while(b){ if(b&1)res = (res * a) % MOD; a = (a * a) % MOD; b >>= 1; } return res; } int main(){ int m; scanf("%d", &m); ll a = 0; while(m--){ int x, y; scanf("%d%d", &x, &y); a = (a + y * pw(x, MOD-2)) % MOD; } printf("%lld", a); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...