# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
19489 | noslaak | Σ (kriii4_P2) | C++98 | 15 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 <iostream>
const int LN = 1000000007;
int modpow( long long A, long long X )
{
int acc = 1;
while(X)
{
A %= LN;
if(X%2)
acc = (A*acc)%LN;
A = A*A;
X /= 2;
}
return acc;
}
int main()
{
int M;
std::cin >> M;
{
long long N, S, acc = 0;
for( int i = 0; i < M; ++i )
{
std::cin >> N >> S;
int rev = modpow(N, LN-2);
int ans = (S*rev)%LN;
acc = (acc+ans)%LN;
}
std::cout << acc << std::endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |