結果

問題 No.220 世界のなんとか2
ユーザー kou6839kou6839
提出日時 2015-08-11 13:09:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 1,000 ms
コード長 402 bytes
コンパイル時間 2,086 ms
コンパイル使用メモリ 71,672 KB
実行使用メモリ 56,292 KB
最終ジャッジ日時 2023-09-25 08:06:59
合計ジャッジ時間 5,698 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,420 KB
testcase_01 AC 125 ms
55,720 KB
testcase_02 AC 123 ms
56,052 KB
testcase_03 AC 122 ms
55,768 KB
testcase_04 AC 123 ms
54,016 KB
testcase_05 AC 122 ms
55,972 KB
testcase_06 AC 123 ms
55,476 KB
testcase_07 AC 127 ms
55,628 KB
testcase_08 AC 125 ms
55,484 KB
testcase_09 AC 122 ms
56,292 KB
testcase_10 AC 123 ms
56,040 KB
testcase_11 AC 126 ms
55,708 KB
testcase_12 AC 126 ms
55,708 KB
testcase_13 AC 125 ms
55,640 KB
testcase_14 AC 132 ms
55,708 KB
testcase_15 AC 128 ms
55,828 KB
testcase_16 AC 127 ms
55,724 KB
testcase_17 AC 127 ms
55,792 KB
testcase_18 AC 131 ms
55,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
	static long[] dp=new long[20];
	static long cul(long p){
		if(p==1){
			return 3;
		}
		if(dp[(int)p]!=0) return dp[(int)p];
		return dp[(int)p]=cul(p-1)*3+(cul(p-1)+1)*3+(cul(p-1)+2)*3+((long)Math.pow(10, p-1)-1);
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long P = sc.nextLong();
		System.out.println(cul(P));
	}
}
0