# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19301 | cki86201 | Σ (kriii4_P2) | C++98 | 6 ms | 1720 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 <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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |