# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19057 | kriii | Σ (kriii4_P2) | C++14 | 0 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 <stdio.h>
const long long mod = 1000000007;
long long fpow(long long a, long long p)
{
a = (a % mod + mod) % mod;
p = (p % (mod - 1) + mod - 1) % (mod - 1);
long long r = 1;
while (p){
if (p & 1) r = r * a % mod;
a = a * a % mod;
p >>= 1;
}
return r;
}
int main()
{
long long ans = 0;
int M; scanf ("%d",&M); while (M--){
long long N,S; scanf ("%lld %lld",&N,&S); ans = (ans + fpow(N,-1) * S) % mod;
}
printf ("%lld\n",ans);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |