結果

問題 No.220 世界のなんとか2
ユーザー ayaoniayaoni
提出日時 2020-12-28 09:32:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 1,000 ms
コード長 683 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 82,796 KB
実行使用メモリ 60,144 KB
最終ジャッジ日時 2024-04-10 08:40:49
合計ジャッジ時間 1,801 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
52,932 KB
testcase_01 AC 36 ms
53,012 KB
testcase_02 AC 39 ms
53,016 KB
testcase_03 AC 38 ms
53,820 KB
testcase_04 AC 38 ms
58,216 KB
testcase_05 AC 38 ms
58,388 KB
testcase_06 AC 38 ms
58,884 KB
testcase_07 AC 42 ms
58,156 KB
testcase_08 AC 42 ms
58,100 KB
testcase_09 AC 38 ms
59,012 KB
testcase_10 AC 39 ms
58,872 KB
testcase_11 AC 39 ms
59,676 KB
testcase_12 AC 42 ms
58,392 KB
testcase_13 AC 39 ms
58,660 KB
testcase_14 AC 38 ms
58,384 KB
testcase_15 AC 38 ms
58,872 KB
testcase_16 AC 39 ms
59,552 KB
testcase_17 AC 41 ms
59,728 KB
testcase_18 AC 40 ms
60,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import factorial
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


P = I()
ans = 0
for i in range(P):
    a = (10**(P-i)//3)*factorial(P)//(factorial(i)*factorial(P-i))
    if i % 2 == 0:
        ans += a
    else:
        ans -= a

ans += pow(10,P)-pow(9,P)-1
print(ans)
0