結果

問題 No.403 2^2^2
ユーザー mits58mits58
提出日時 2016-07-25 19:22:22
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 577 bytes
コンパイル時間 3,016 ms
コンパイル使用メモリ 76,436 KB
実行使用メモリ 42,580 KB
最終ジャッジ日時 2024-04-24 08:57:29
合計ジャッジ時間 8,607 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
41,924 KB
testcase_01 AC 141 ms
41,908 KB
testcase_02 AC 151 ms
42,348 KB
testcase_03 AC 152 ms
42,176 KB
testcase_04 AC 153 ms
42,496 KB
testcase_05 AC 138 ms
41,968 KB
testcase_06 AC 151 ms
42,352 KB
testcase_07 AC 137 ms
41,708 KB
testcase_08 AC 151 ms
42,368 KB
testcase_09 AC 152 ms
42,236 KB
testcase_10 AC 155 ms
42,212 KB
testcase_11 AC 154 ms
42,292 KB
testcase_12 AC 136 ms
41,924 KB
testcase_13 AC 152 ms
42,336 KB
testcase_14 AC 150 ms
42,316 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 152 ms
42,336 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 155 ms
42,268 KB
testcase_23 AC 153 ms
42,332 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 152 ms
42,356 KB
testcase_27 AC 151 ms
42,420 KB
testcase_28 WA -
testcase_29 AC 153 ms
42,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	static long mod=1000000007;
	static long pow(long a,long x,long m){
		if(x==0) return 1;
		else if(x%2==0) return pow((a*a)%m,x/2,m)%m;
		else return (a*pow((a*a)%m,x/2,m))%m;
	}
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			String[] str=(sc.next()).split("\\^");
			long a=Long.valueOf(str[0]),b=Long.valueOf(str[1]),c=Long.valueOf(str[2]);
			long ab=pow(a,b,mod); ab=pow(ab,c,mod);
			long bc=pow(b,c,mod-1); bc=pow(a,bc,mod);
			System.out.println(ab+" "+bc);
		}
	}
}
0