HDOJ 1420 Prepared for New Acmer

来源:互联网 发布:2017年好听的网络歌曲 编辑:程序博客网 时间:2024/06/01 14:34

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();    }}
原创粉丝点击