Problem list
Log in
#r00002 · 주몽이(original)

쉬운 문제

Gold IV 1.0 s 256 MB

이 문제는 날로 먹는 문제이다. 아주 쉬우니, 5분만에 풀고 다음 문제로 넘어가자.

Input

펏 줄에 테스트케이스의 수 n이 주어진다. 그리고 다음 n줄에 a, b가 주어진다. $a^b$ mod b를 구하자.

Output

각 줄에 $a^b$ mod b를 출력한다.

Constraints

($1 ≤ n ≤ 50$), ($1 ≤ a, b ≤ 10^9$ (단, b는 소수))

Example 1

Input
1
1 7
Output
1
Source
주몽이(original) by joomongogo
Appears in
Not part of a ladder, contest or set yet.
Accepted 6 Submissions 19 Acceptance 62% Solvers 5

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code