結果

問題 No.175 simpleDNA
ユーザー tentententen
提出日時 2020-11-04 12:46:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 426 bytes
コンパイル時間 2,033 ms
コンパイル使用メモリ 70,900 KB
実行使用メモリ 56,056 KB
最終ジャッジ日時 2023-09-29 15:47:04
合計ジャッジ時間 3,976 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,616 KB
testcase_01 AC 121 ms
55,700 KB
testcase_02 AC 121 ms
55,972 KB
testcase_03 AC 122 ms
55,384 KB
testcase_04 AC 122 ms
56,056 KB
testcase_05 AC 122 ms
55,536 KB
testcase_06 AC 123 ms
55,700 KB
testcase_07 AC 120 ms
55,836 KB
testcase_08 AC 120 ms
55,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int length = sc.nextInt();
		int n = sc.nextInt();
		System.out.println(pow(2, length - 3) * n);
	}
	
	static long pow(long n, long p) {
	    if (p == 0) {
	        return 1;
	    } else if (p % 2 == 0) {
	        return pow(n * n, p / 2);
	    } else {
	        return n * pow(n, p - 1);
	    }
	}
}
0