| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 19493 | noslaak | Σ (kriii4_P2) | C++98 | 15 ms | 1720 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
while( std::cin >> M )
{
int N, S, acc = 0;
for( int i = 0; i < M; ++i )
{
std::cin >> N >> S;
int rev = modpow(N, LN-2);
int ans = ((long long)S*rev)%LN;
acc = (acc+ans)%LN;
}
std::cout << acc << std::endl;
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
