結果

問題 No.222 引き算と足し算
ユーザー te-sh
提出日時 2017-05-18 10:51:57
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 303 bytes
コンパイル時間 7,119 ms
コンパイル使用メモリ 299,548 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 19:20:06
合計ジャッジ時間 8,257 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.regex;     // RegEx

void main()
{
  auto s = readln.chomp;

  auto ci = s.matchFirst(r"([+-]?\d+)([+-])([+-]?\d+)");
  auto x = ci[1].to!int, op = ci[2], y = ci[3].to!int;

  writeln(op.predSwitch("+", x - y, "-", x + y));
}
0