結果
問題 | No.294 SuperFizzBuzz |
ユーザー |
|
提出日時 | 2015-12-09 19:53:25 |
言語 | PyPy2 (7.3.15) |
結果 |
AC
|
実行時間 | 1,757 ms / 5,000 ms |
コード長 | 841 bytes |
コンパイル時間 | 2,108 ms |
コンパイル使用メモリ | 76,680 KB |
実行使用メモリ | 91,656 KB |
最終ジャッジ日時 | 2024-09-15 05:56:47 |
合計ジャッジ時間 | 12,049 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
# -*- coding: utf-8 -*-import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as colldef comb(n, r):res = 1for i in xrange(r):res *= n - ifor i in xrange(1, r + 1):res /= ireturn resans = 0N = int(raw_input())#3は5n個、5は3m個。1桁目は必ず5for k in xrange(3, 26):cnt = 0f = set()for i in xrange(3, k + 1, 3):j = k - icnt += comb(j + i - 1, i - 1)f.add(i)if N > cnt:N -= cntelse:x = -1while N:x += 2y = xcnt = 0while y:cnt += y&1y /= 2if cnt in f:N -= 1ans = bin(x)[2:].zfill(k).replace("0", "3").replace("1", "5")breakif ans > 0: breakprint ans