当前位置: 代码迷 >> 综合 >> HDOJ 1420 Prepared for New Acmer
  详细解决方案

HDOJ 1420 Prepared for New Acmer

热度:84   发布时间:2023-10-21 19:17:52.0

HDACM 1420

类似1395
注意相乘可能超过int范围。

import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc = new Scanner(System.in);int n = sc.nextInt();while (n-->0) {int a = sc.nextInt();int b = sc.nextInt();int c = sc.nextInt();long t = 1;while (b-->0) {t = (t*a)%c;}System.out.println(t);}sc.close();}
}