結果
問題 | No.220 世界のなんとか2 |
ユーザー | 👑 rin204 |
提出日時 | 2022-07-04 14:55:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 1,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 82,088 KB |
実行使用メモリ | 54,156 KB |
最終ジャッジ日時 | 2024-12-14 04:44:12 |
合計ジャッジ時間 | 1,788 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
p = int(input()) dp = [0, 0, 0] ans = 0 plus = 10 ** (p - 1) for i in range(p): ans += (sum(dp) + 1) * plus plus //= 10 ndp = [0] * 3 for i in range(10): if i == 3: continue for j in range(3): ndp[(i + j) % 3] += dp[j] for i in range(1, 10): if i == 3: continue ndp[i % 3] += 1 dp = ndp print(ans + dp[0])