結果

問題 No.254 文字列の構成
ユーザー TawaraTawara
提出日時 2015-08-02 00:18:56
言語 Python2
(2.7.18)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 365 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 6,680 KB
実行使用メモリ 9,488 KB
最終ジャッジ日時 2023-09-25 00:28:21
合計ジャッジ時間 2,723 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
6,860 KB
testcase_01 AC 15 ms
6,696 KB
testcase_02 AC 16 ms
6,804 KB
testcase_03 AC 16 ms
6,748 KB
testcase_04 AC 15 ms
6,700 KB
testcase_05 AC 16 ms
6,872 KB
testcase_06 AC 15 ms
6,808 KB
testcase_07 AC 15 ms
6,852 KB
testcase_08 AC 16 ms
6,864 KB
testcase_09 AC 16 ms
6,808 KB
testcase_10 AC 16 ms
6,748 KB
testcase_11 AC 15 ms
6,660 KB
testcase_12 AC 16 ms
6,700 KB
testcase_13 AC 16 ms
6,680 KB
testcase_14 AC 16 ms
6,832 KB
testcase_15 AC 17 ms
7,072 KB
testcase_16 AC 20 ms
7,736 KB
testcase_17 AC 32 ms
9,488 KB
testcase_18 AC 33 ms
9,340 KB
testcase_19 AC 31 ms
9,188 KB
testcase_20 AC 28 ms
8,660 KB
testcase_21 AC 32 ms
9,368 KB
testcase_22 AC 24 ms
8,272 KB
testcase_23 AC 27 ms
8,592 KB
testcase_24 AC 26 ms
8,480 KB
testcase_25 AC 31 ms
9,340 KB
testcase_26 AC 30 ms
8,932 KB
testcase_27 AC 31 ms
9,036 KB
testcase_28 AC 29 ms
8,712 KB
testcase_29 AC 32 ms
9,284 KB
testcase_30 AC 31 ms
9,072 KB
testcase_31 AC 22 ms
7,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def c_s(s,i):
	return [chr(s+(j&1)) for j in range(2*i-1)]
N = int(raw_input())
M = 1<<15
C = [i**2 for i in xrange(M)]
for i in xrange(1,M):
	if C[i+1] <= N:
		continue
	ans = c_s(97,i)
	rest = N - C[i]
	for j in range(1,rest+1):
		if C[j+1] <= rest:
			continue
		ans += c_s(99,j) + [chr(101+(k%22)) for k in xrange(rest-C[j])]
		break
	print "".join(ans)
	break
0