結果

問題 No.1429 Simple Dowsing
ユーザー StrorkisStrorkis
提出日時 2021-03-14 15:25:27
言語 Rust
(1.77.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 542 ms
コンパイル使用メモリ 142,012 KB
実行使用メモリ 24,348 KB
平均クエリ数 3.00
最終ジャッジ日時 2023-09-24 10:07:23
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,508 KB
testcase_01 AC 25 ms
24,024 KB
testcase_02 AC 25 ms
23,520 KB
testcase_03 AC 25 ms
23,664 KB
testcase_04 AC 25 ms
23,892 KB
testcase_05 AC 25 ms
24,024 KB
testcase_06 AC 24 ms
24,348 KB
testcase_07 AC 25 ms
23,340 KB
testcase_08 AC 25 ms
23,772 KB
testcase_09 AC 25 ms
23,892 KB
testcase_10 AC 26 ms
24,024 KB
testcase_11 AC 26 ms
24,036 KB
testcase_12 AC 26 ms
23,364 KB
testcase_13 AC 25 ms
24,012 KB
testcase_14 AC 25 ms
23,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let stdin = std::io::stdin();
    let ref mut stdin = stdin.lock();

    println!("? 0 0");
    let ref mut buf = String::new();
    std::io::BufRead::read_line(stdin, buf).ok();
    let d1: u32 = buf.trim().parse().unwrap();

    println!("? 100 0");
    let ref mut buf = String::new();
    std::io::BufRead::read_line(stdin, buf).ok();
    let d2: u32 = buf.trim().parse().unwrap();

    for a in 0u32..=100 {
        for b in 0u32..=100 {
            if a.pow(2) + b.pow(2) == d1 && (100 - a).pow(2) + b.pow(2) == d2 {
                println!("! {} {}", a, b);
            }
        }
    }
}
0