結果
問題 | No.254 文字列の構成 |
ユーザー |
|
提出日時 | 2017-05-26 17:16:55 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 506 bytes |
コンパイル時間 | 715 ms |
コンパイル使用メモリ | 102,652 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 19:28:04 |
合計ジャッジ時間 | 2,060 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;import std.math; // math functionsconst 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]);}