結果

問題 No.513 宝探し2
ユーザー te-shte-sh
提出日時 2017-05-05 23:34:18
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 707 bytes
コンパイル時間 684 ms
コンパイル使用メモリ 99,428 KB
実行使用メモリ 25,476 KB
平均クエリ数 4.08
最終ジャッジ日時 2024-06-12 19:02:22
合計ジャッジ時間 1,700 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

const ma = 100000;

void main()
{
  auto ans = int.max;
  auto xi = 0, xa = ma;
  auto yi = 0, ya = ma;
  auto ri = 0, ra = 0;

  writeln(xi, " ", yi); stdout.flush();
  ri = readln.chomp.to!int;
  if (ri == 0)
    return;

  writeln(xa, " ", yi); stdout.flush();
  ra = readln.chomp.to!int;
  if (ra == 0)
    return;

  auto x = (ma - (ra - ri)) / 2;

  writeln(x, " ", yi); stdout.flush();
  ri = readln.chomp.to!int;
  if (ri == 0)
    return;

  writeln(x, " ", ya); stdout.flush();
  ra = readln.chomp.to!int;
  if (ra == 0)
    return;

  auto y = (ma - (ra - ri)) / 2;
  writeln(x, " ", y); stdout.flush();
  readln.chomp.to!int;
}
0