結果

問題 No.208 王将
ユーザー te-sh
提出日時 2017-05-12 12:07:37
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 418 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 102,648 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 19:13:03
合計ジャッジ時間 1,694 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.math;      // math functions

void main()
{
  auto rd1 = readln.split.to!(int[]), x = rd1[0], y = rd1[1];
  auto rd2 = readln.split.to!(int[]), x2 = rd2[0], y2 = rd2[1];

  if (x != y) {
    auto c = min(x, y);
    writeln(c + (x - c) + (y - c));
  } else {
    if (x2 == y2 && x2 < x)
      writeln(x + 1);
    else
      writeln(x);
  }
}
0