結果

問題 No.294 SuperFizzBuzz
ユーザー H3PO4H3PO4
提出日時 2020-06-14 09:39:40
言語 PyPy3
(7.3.13)
結果
TLE  
実行時間 -
コード長 560 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 380,124 KB
最終ジャッジ日時 2023-09-09 07:33:52
合計ジャッジ時間 7,338 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
380,124 KB
testcase_01 AC 77 ms
74,976 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
from math import factorial

comb = lambda n, k: factorial(n) // (factorial(k) * factorial(n - k))

N = int(input())

ct, cur = 0, 0
i = 3
while ct + cur < N:
    ct += cur
    cur = 0
    for fives_num in range(3, i + 1, 3):
        cur += comb(i - 1, fives_num - 1)
    i += 1

i -= 1
lst = []
for fives_num in range(3, i + 1, 3):
    for t in itertools.combinations(range(i - 1), fives_num - 1):
        x = int(''.join(map(str, ['5' if j in t else '3' for j in range(i - 1)])) + '5')
        lst.append(x)
lst.sort()
print(lst[N - ct - 1])
0