結果
問題 |
No.536 人工知能
|
ユーザー |
|
提出日時 | 2018-01-07 08:55:22 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 802 bytes |
コンパイル時間 | 998 ms |
コンパイル使用メモリ | 98,320 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 23:21:05 |
合計ジャッジ時間 | 1,537 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import std.stdio : writeln; void main() { import std.algorithm : endsWith; import std.string : toUpper; string s; scan(s); if (s.endsWith("ai")) { writeln(s[0 .. $-2] ~ s[$-2 .. $].toUpper); } else { writeln(s ~ "-AI"); } } void scan(T...)(ref T args) { import std.stdio : readln; import std.array : split; import std.conv : to; import std.range.primitives; string[] line = readln.split; foreach (ref arg; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); } void fillAll(R, T)(ref R arr, T value) { static if (is(typeof(arr[] = value))) { arr[] = value; } else { foreach (ref e; arr) { fillAll(e, value); } } }