結果
問題 |
No.254 文字列の構成
|
ユーザー |
![]() |
提出日時 | 2015-08-31 16:00:37 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 14 ms / 5,000 ms |
コード長 | 401 bytes |
コンパイル時間 | 45 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 17:00:30 |
合計ジャッジ時間 | 2,370 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
from math import sqrt, floor N = input() ans = [] while N > 0: x = int(floor(sqrt(N))) ans.append(x) N -= x * x def to_iwi(n, idx): c0 = chr(idx + ord('a')) c1 = chr(idx + ord('a') + 1) res = [c0] for i in xrange(n): res.append(c1) res.append(c0) return ''.join(res) ans = [to_iwi(ans[i]-1, (i % 13)*2) for i in xrange(len(ans))] print(''.join(ans))