Logo
(追記) (追記ここまで)

24009번 - Huge Numbers 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
40 초 (추가 시간 없음) 1024 MB4031279532.872%

문제

Professor Shekhu has another problem for Akki today. He has given him three positive integers A, N and P and wants him to calculate the remainder when AN! is divided by P. As usual, N! denotes the product of the first N positive integers.

입력

The first line of the input gives the number of test cases, T. T lines follow. Each line contains three integers A, N and P, as described above.

출력

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the answer.

제한

  • 1 ≤ T ≤ 100.

Test Set 1 (9점)

  • 1 ≤ A ≤ 10.
  • 1 ≤ N ≤ 10.
  • 1 ≤ P ≤ 10.

Test Set 2 (14점)

  • 1 ≤ A ≤ 105.
  • 1 ≤ N ≤ 105.
  • 1 ≤ P ≤ 105.

예제 입력 1

2
2 1 2
3 3 2

예제 출력 1

Case #1: 0
Case #2: 1

힌트

In Sample Case #1, the answer is the remainder when 21! = 2 is divided by 2, which is 0.

In Sample Case #2, the answer is the remainder when 33! = 36 = 729 is divided by 2, which is 1.

출처

Contest > Google > Kick Start > Google Kick Start 2017 > Round G A번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /