結果
問題 | No.294 SuperFizzBuzz |
ユーザー | roiti46 |
提出日時 | 2015-12-09 19:53:25 |
言語 | PyPy2 (7.3.15) |
結果 |
AC
|
実行時間 | 1,682 ms / 5,000 ms |
コード長 | 841 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 78,012 KB |
実行使用メモリ | 93,900 KB |
最終ジャッジ日時 | 2023-10-13 08:47:34 |
合計ジャッジ時間 | 11,330 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 157 ms
92,036 KB |
testcase_01 | AC | 155 ms
92,600 KB |
testcase_02 | AC | 1,642 ms
93,276 KB |
testcase_03 | AC | 152 ms
92,388 KB |
testcase_04 | AC | 149 ms
92,292 KB |
testcase_05 | AC | 151 ms
92,276 KB |
testcase_06 | AC | 156 ms
92,888 KB |
testcase_07 | AC | 164 ms
92,808 KB |
testcase_08 | AC | 208 ms
93,688 KB |
testcase_09 | AC | 1,125 ms
93,536 KB |
testcase_10 | AC | 150 ms
92,412 KB |
testcase_11 | AC | 1,354 ms
93,900 KB |
testcase_12 | AC | 1,466 ms
93,632 KB |
testcase_13 | AC | 1,539 ms
93,400 KB |
testcase_14 | AC | 1,682 ms
93,772 KB |
ソースコード
# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll def comb(n, r): res = 1 for i in xrange(r): res *= n - i for i in xrange(1, r + 1): res /= i return res ans = 0 N = int(raw_input()) #3は5n個、5は3m個。1桁目は必ず5 for k in xrange(3, 26): cnt = 0 f = set() for i in xrange(3, k + 1, 3): j = k - i cnt += comb(j + i - 1, i - 1) f.add(i) if N > cnt: N -= cnt else: x = -1 while N: x += 2 y = x cnt = 0 while y: cnt += y&1 y /= 2 if cnt in f: N -= 1 ans = bin(x)[2:].zfill(k).replace("0", "3").replace("1", "5") break if ans > 0: break print ans