結果

問題 No.220 世界のなんとか2
ユーザー kou6839kou6839
提出日時 2015-08-11 13:07:56
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 364 bytes
コンパイル時間 2,017 ms
コンパイル使用メモリ 71,800 KB
実行使用メモリ 60,168 KB
最終ジャッジ日時 2023-09-25 08:06:51
合計ジャッジ時間 10,038 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
60,028 KB
testcase_01 AC 130 ms
55,692 KB
testcase_02 AC 127 ms
56,032 KB
testcase_03 AC 130 ms
55,744 KB
testcase_04 AC 125 ms
55,744 KB
testcase_05 AC 124 ms
55,740 KB
testcase_06 AC 125 ms
56,084 KB
testcase_07 AC 129 ms
55,628 KB
testcase_08 AC 127 ms
55,460 KB
testcase_09 AC 128 ms
55,728 KB
testcase_10 AC 128 ms
55,868 KB
testcase_11 AC 130 ms
56,276 KB
testcase_12 AC 135 ms
55,712 KB
testcase_13 AC 148 ms
55,432 KB
testcase_14 AC 189 ms
55,472 KB
testcase_15 AC 315 ms
55,892 KB
testcase_16 AC 658 ms
55,736 KB
testcase_17 TLE -
testcase_18 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Main {
	static long[] dp=new long[20];
	static long cul(long p){
		if(p==1){
			return 3;
		}
		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