結果
問題 |
No.781 円周上の格子点の数え上げ
|
ユーザー |
|
提出日時 | 2022-12-08 23:49:07 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 250 ms / 2,000 ms |
コード長 | 738 bytes |
コンパイル時間 | 12,615 ms |
コンパイル使用メモリ | 378,788 KB |
実行使用メモリ | 80,000 KB |
最終ジャッジ日時 | 2024-10-14 18:10:31 |
合計ジャッジ時間 | 15,360 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
fn main() { let mut temp = String::new(); std::io::stdin().read_line(&mut temp).ok(); let temp: Vec<usize> = temp.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let x = temp[0]; let y = temp[1]; let mut result = vec![0usize; y+1]; for i in 0.. { let val = i * i; if val > y { break; } for j in 0.. { if i == 0 && j == 0 { continue; } let val2 = j * j; let idx = val + val2; if idx > y { break; } if val == 0 || val2 == 0 { result[idx] += 2; } else { result[idx] += 4; } } } println!("{}", (x..=y).map(|i| result[i]).max().unwrap()); }