結果
問題 |
No.1200 お菓子配り-3
|
ユーザー |
![]() |
提出日時 | 2020-08-28 23:27:22 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,805 bytes |
コンパイル時間 | 12,833 ms |
コンパイル使用メモリ | 382,372 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 17:09:42 |
合計ジャッジ時間 | 24,862 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 5 WA * 26 |
ソースコード
use std::io::{BufRead, Write}; fn main () { let stdin = std::io::stdin(); let stdout = std::io::stdout(); let mut reader = std::io::BufReader::new(stdin.lock()); let mut writer = std::io::BufWriter::new(stdout.lock()); let s: usize = { let mut buf = String::new(); reader.read_line(&mut buf).unwrap(); buf.trim_end().parse().unwrap() }; for _ in 0..s { let (x, y): (i64, i64) = { let mut buf = String::new(); reader.read_line(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), ) }; let z = x + y; let mut ans = 0; let mut i = 2; while i * i <= z { if z % i == 0 { { let a = i - 1; let q = z / i; if a > 1 && (x - q) % (a - 1) == 0 && (y - q) % (a - 1) == 0 { let b = (x - q) % (a - 1); let c = (y - q) % (a - 1); if b + c == q { ans += 1; } } } if i * i != z { let a = z / i - 1; let q = i; if a > 1 && (x - q) % (a - 1) == 0 && (y - q) % (a - 1) == 0 { let b = (x - q) % (a - 1); let c = (y - q) % (a - 1); if b + c == q { ans += 1; } } } } i += 1; } writeln!(writer, "{}", ans).unwrap(); } }