結果
問題 | No.294 SuperFizzBuzz |
ユーザー |
![]() |
提出日時 | 2019-12-09 08:29:37 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 752 bytes |
コンパイル時間 | 442 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-06-11 19:55:32 |
合計ジャッジ時間 | 1,849 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
def C(n, r):if r>n:return 0return fact[n]//fact[r]//fact[n-r]def F(n):res = 0for i in range(2, n, 3):res += C(n-1, i)return resdef G():res = 0c = ans.count('5')l = len(ans)if c%3==0:s = 2elif c%3==1:s = 1else:s = 0for i in range(s, L-l-1, 3):res += C(L-l-2, i)return resN = int(input())fact = [1]for i in range(1, 30):fact.append(fact[-1]*i)i = 3while True:f = F(i)if N-f>0:N -= fi += 1else:breakL = ians = ''for i in range(L):g = G()if N-g>0:ans += '5'N -= gelse:ans += '3'print(ans)