結果

問題 No.294 SuperFizzBuzz
ユーザー roiti46roiti46
提出日時 2015-12-09 19:48:59
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 768 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 6,636 KB
実行使用メモリ 8,736 KB
最終ジャッジ日時 2023-10-13 08:46:52
合計ジャッジ時間 6,889 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
7,772 KB
testcase_01 AC 23 ms
7,904 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 #

# -*- 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 = []
    for i in xrange(3, k + 1, 3):
        j = k - i
        cnt += comb(j + i - 1, i - 1)
        f.append(i)
    if N > cnt:
        N -= cnt
    else:
        x = -1
        while N:
            x += 2
            b = bin(x)[2:]
            if b.count("1") in f:
                N -= 1
        ans = bin(x)[2:].zfill(k).replace("0", "3").replace("1", "5")
        break
    if ans > 0: break
print ans
0