結果

問題 No.594 壊れた宝物発見機
ユーザー ikdikd
提出日時 2017-11-14 16:59:22
言語 D
(dmd 2.106.1)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 896 bytes
コンパイル時間 27 ms
コンパイル使用メモリ 6,784 KB
最終ジャッジ日時 2024-04-27 02:29:54
合計ジャッジ時間 414 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
Main.d(19): Error: `dif < 0 ? l : r` must be surrounded by parentheses when next to operator `=`
Main.d(26): Error: `dif < 0 ? l : r` must be surrounded by parentheses when next to operator `=`
Main.d(33): Error: `dif < 0 ? l : r` must be surrounded by parentheses when next to operator `=`

ソースコード

diff #

void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int ask(int x, int y, int z){
    writeln("? ", x, " ", y, " ", z);
    stdout.flush();
    auto d=readln.chomp.to!(int);
    return d;
  }
  void answer(int x, int y, int z){
    writeln("! ", x, " ", y, " ", z);
  }

  int x, y, z;
  int l=-150, r=150;
  while(r-l>1){
    auto m=(r+l)/2;
    auto dif=ask(m, y, z)-ask(m-1, y, z);
    dif<0 ? l : r = m;
  }
  x=l;
  l=-150, r=150;
  while(r-l>1){
    auto m=(r+l)/2;
    auto dif=ask(x, m, z)-ask(x, m-1, z);
    dif<0 ? l : r = m;
  }
  y=l;
  l=-150, r=150;
  while(r-l>1){
    auto m=(r+l)/2;
    auto dif=ask(x, y, m)-ask(x, y, m-1);
    dif<0 ? l : r = m;
  }
  z=l;

  answer(x, y, z);
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
0