結果

問題 No.1429 Simple Dowsing
ユーザー kokatsukokatsu
提出日時 2022-04-07 20:01:11
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 2,982 ms
コンパイル使用メモリ 204,632 KB
実行使用メモリ 24,336 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-04 16:39:41
合計ジャッジ時間 4,115 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,304 KB
testcase_01 AC 25 ms
24,180 KB
testcase_02 AC 25 ms
23,520 KB
testcase_03 AC 25 ms
24,312 KB
testcase_04 AC 24 ms
23,292 KB
testcase_05 AC 25 ms
23,460 KB
testcase_06 AC 24 ms
23,544 KB
testcase_07 AC 25 ms
24,252 KB
testcase_08 AC 25 ms
24,336 KB
testcase_09 AC 24 ms
23,268 KB
testcase_10 AC 25 ms
23,316 KB
testcase_11 AC 24 ms
23,580 KB
testcase_12 AC 23 ms
23,556 KB
testcase_13 AC 25 ms
23,316 KB
testcase_14 AC 25 ms
23,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int L = 100;
    int[] p = [0, L], q = [0, 0];

    auto d = new int[](2);
    foreach (i; 0 .. 2) {
        writefln("? %d %d", p[i], q[i]);
        stdout.flush;

        readf("%d\n", d[i]);
    }

    int r = (L * L + d[0] - d[1]) / (L * 2);
    int s = to!real(d[0]-r*r).sqrt.floor.to!int;

    writefln("! %d %d", r, s);
}
0