結果

問題 No.220 世界のなんとか2
ユーザー yaoshimaxyaoshimax
提出日時 2015-05-31 18:38:25
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 493 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 6,696 KB
実行使用メモリ 6,104 KB
最終ジャッジ日時 2023-09-20 18:08:44
合計ジャッジ時間 1,530 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,976 KB
testcase_01 AC 11 ms
6,080 KB
testcase_02 AC 11 ms
6,084 KB
testcase_03 AC 11 ms
6,084 KB
testcase_04 AC 11 ms
5,972 KB
testcase_05 AC 11 ms
5,820 KB
testcase_06 AC 11 ms
6,048 KB
testcase_07 AC 11 ms
6,104 KB
testcase_08 AC 11 ms
6,044 KB
testcase_09 AC 12 ms
6,084 KB
testcase_10 AC 11 ms
5,880 KB
testcase_11 AC 11 ms
5,876 KB
testcase_12 AC 12 ms
6,084 KB
testcase_13 AC 11 ms
5,932 KB
testcase_14 AC 12 ms
5,972 KB
testcase_15 AC 12 ms
6,084 KB
testcase_16 AC 12 ms
6,012 KB
testcase_17 AC 12 ms
5,996 KB
testcase_18 AC 12 ms
5,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P=int(raw_input())
dp=[[[0 for i in range(2)] for k in range(3)] for j in range(P+1)]
dp[0][0][0]=1
ans=0
for i in range(0,P):
    for j in range(3):
        for k in range(2):
            for b in range(10):
                if b==0 and i==0:
                    continue
                I,J,K=i+1,(j+b)%3,k
                if b==3:
                    K=1
                dp[I][J][K]+=dp[i][j][k]
                if K==1 and J!=0:
                    ans+=dp[i][j][k]
print ans + pow(10,P)/3
0