結果

問題 No.254 文字列の構成
ユーザー yuppe19 😺
提出日時 2015-09-03 10:10:06
言語 Python2
(2.7.18)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 383 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 8,576 KB
最終ジャッジ日時 2024-07-18 21:53:08
合計ジャッジ時間 2,360 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python
from string import lowercase as lo
from itertools import izip_longest

def nya(n, i, cat):
    if n == 0:
        return cat
    sq = int(n ** .5)
    l = 2*sq - 1
    a, b = lo[i], lo[-i-1]
    x, y = l/2+1, l/2
    return nya(n-sq*sq, (i+1)%N, cat+''.join(map(''.join, izip_longest(a*x, b*y, fillvalue=''))))

n = int(raw_input())
N = len(lo)
print nya(n, 0, '')
0