結果

問題 No.254 文字列の構成
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-09-03 10:10:06
言語 Python2
(2.7.18)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 383 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 6,652 KB
実行使用メモリ 8,436 KB
最終ジャッジ日時 2023-09-26 02:33:05
合計ジャッジ時間 3,159 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,120 KB
testcase_01 AC 13 ms
6,468 KB
testcase_02 AC 13 ms
6,536 KB
testcase_03 AC 13 ms
6,368 KB
testcase_04 AC 13 ms
6,408 KB
testcase_05 AC 12 ms
6,368 KB
testcase_06 AC 13 ms
6,568 KB
testcase_07 AC 13 ms
6,332 KB
testcase_08 AC 13 ms
6,328 KB
testcase_09 AC 15 ms
6,540 KB
testcase_10 AC 13 ms
6,328 KB
testcase_11 AC 13 ms
6,368 KB
testcase_12 AC 13 ms
6,496 KB
testcase_13 AC 13 ms
6,392 KB
testcase_14 AC 13 ms
6,432 KB
testcase_15 AC 14 ms
6,432 KB
testcase_16 AC 15 ms
6,788 KB
testcase_17 AC 19 ms
8,436 KB
testcase_18 AC 19 ms
8,240 KB
testcase_19 AC 18 ms
8,164 KB
testcase_20 AC 18 ms
7,960 KB
testcase_21 AC 19 ms
8,300 KB
testcase_22 AC 16 ms
7,112 KB
testcase_23 AC 16 ms
7,492 KB
testcase_24 AC 17 ms
7,392 KB
testcase_25 AC 19 ms
8,304 KB
testcase_26 AC 18 ms
8,152 KB
testcase_27 AC 19 ms
8,232 KB
testcase_28 AC 17 ms
8,012 KB
testcase_29 AC 19 ms
8,184 KB
testcase_30 AC 19 ms
8,344 KB
testcase_31 AC 15 ms
7,160 KB
権限があれば一括ダウンロードができます

ソースコード

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