結果

問題 No.1200 お菓子配り-3
ユーザー StrorkisStrorkis
提出日時 2020-08-29 10:02:14
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,403 bytes
コンパイル時間 10,728 ms
コンパイル使用メモリ 404,512 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 03:29:02
合計ジャッジ時間 17,525 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 4 ms
6,944 KB
testcase_08 AC 5 ms
6,940 KB
testcase_09 AC 5 ms
6,940 KB
testcase_10 AC 5 ms
6,940 KB
testcase_11 AC 5 ms
6,940 KB
testcase_12 AC 45 ms
6,944 KB
testcase_13 AC 42 ms
6,940 KB
testcase_14 AC 42 ms
6,944 KB
testcase_15 AC 42 ms
6,940 KB
testcase_16 AC 41 ms
6,940 KB
testcase_17 AC 151 ms
6,940 KB
testcase_18 AC 221 ms
6,940 KB
testcase_19 AC 48 ms
6,944 KB
testcase_20 AC 406 ms
6,940 KB
testcase_21 AC 404 ms
6,944 KB
testcase_22 AC 473 ms
6,940 KB
testcase_23 AC 409 ms
6,940 KB
testcase_24 AC 395 ms
6,940 KB
testcase_25 AC 409 ms
6,944 KB
testcase_26 AC 400 ms
6,940 KB
testcase_27 AC 1 ms
6,944 KB
testcase_28 AC 318 ms
6,940 KB
testcase_29 AC 907 ms
6,940 KB
testcase_30 AC 903 ms
6,940 KB
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::Write;

fn main () {
    let stdout = std::io::stdout();
    let mut writer = std::io::BufWriter::new(stdout.lock());

    let s: usize = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().parse().unwrap()
    };

    for _ in 0..s {
        let (x, y): (i64, i64) = {
            let mut buf = String::new();
            std::io::stdin().read_line(&mut buf).unwrap();
            let mut iter = buf.split_whitespace();
            (
                iter.next().unwrap().parse().unwrap(),
                iter.next().unwrap().parse().unwrap(),
            )
        };

        let p = x + y;
        let q = (x - y).abs();
        let mut ans = 0;
        let mut i = 1;
        while i * i <= q {
            if q % i > 0 {
                i += 1;
                continue;
            }
            let j = q / i;
            if p % (i + 2) == 0 {
                let u = p / (i + 2);
                let v = j;
                if u > v && (u + v) % 2 == 0 {
                    ans += 1;
                }
            }
            if i != j && p % (j + 2) == 0 {
                let u = p / (j + 2);
                let v = i;
                if u > v && (u + v) % 2 == 0 {
                    ans += 1;
                }
            }
            i += 1;
        }
        writeln!(writer, "{}", ans).unwrap();
    }
}
0