結果
問題 | No.254 文字列の構成 |
ユーザー |
![]() |
提出日時 | 2022-03-10 01:41:44 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 105 ms / 5,000 ms |
コード長 | 482 bytes |
コンパイル時間 | 70 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-09-14 02:55:24 |
合計ジャッジ時間 | 4,520 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_idef build_str(ch, len)res = ''(len - 1).times dores << chres << ch.succendres << chch.succ!if ch == 'z'ch = 'a'elsech.succ!endresendcur = 'a'ans = ''n = Nwhile n > 0len = 0cnt = 0while (cnt * (cnt + 1)) / 2 + (cnt * (cnt - 1)) / 2 <= ncnt += 1len += 1endcnt -= 1len -= 1n -= (cnt * (cnt + 1)) / 2 + (cnt * (cnt - 1)) / 2str = build_str(cur, len)ans << strendputs ans