結果
| 問題 | No.254 文字列の構成 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-26 17:16:55 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 5,000 ms |
| コード長 | 506 bytes |
| 記録 | |
| コンパイル時間 | 490 ms |
| コンパイル使用メモリ | 86,336 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-05 14:50:05 |
| 合計ジャッジ時間 | 1,791 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math; // math functions
const aba = ["ab", "cd", "ef", "gh", "ij"];
void main()
{
auto n = readln.chomp.to!int;
auto i = 0;
while (n > 15) {
auto k = n.to!real.sqrt.floor.to!int;
if (aba) {
foreach (_; 0..k-1) write(aba[i]);
write(aba[i][0]);
} else {
foreach (_; 0..k-1) write(aba[i]);
write(aba[i][0]);
}
n -= k * k;
++i;
}
writeln("klmnopqrstuvwxy"[0..n]);
}