# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19485 | zych1751 | Σ (kriii4_P2) | C++98 | 7 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<cstdio>
const int INF = 1e9+7;
long long mod(long long a) // a^(x-2)
{
int mul = 1e9+5;
long long result = 1;
a %= INF;
while(mul)
{
if(mul & 1)
result = (result * a) % INF;
a = (a*a) % INF;
mul /= 2;
}
return result;
}
int main()
{
int m;
long long n, s;
long long result = 0;
scanf("%d", &m);
for(int i = 0; i < m; i++)
{
scanf("%lld %lld", &n, &s);
result += s * mod(n);
result %= INF;
}
printf("%lld", result);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |