結果
問題 |
No.1381 Simple Geometry 1
|
ユーザー |
|
提出日時 | 2021-02-07 21:56:06 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,161 bytes |
コンパイル時間 | 14,747 ms |
コンパイル使用メモリ | 380,560 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-04 15:21:38 |
合計ジャッジ時間 | 15,637 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 WA * 27 |
ソースコード
use std::io::*; fn check(a: f64, b: f64, y: f64, z: f64, w: f64) -> bool { if y * y + a * a + w * w - 2. * w * (y * y + a * a).sqrt() == z * z + b * b { return true; } false } fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let x: usize = itr.next().unwrap().parse().unwrap(); let y: f64 = itr.next().unwrap().parse().unwrap(); let z: f64 = itr.next().unwrap().parse().unwrap(); let w: f64 = itr.next().unwrap().parse().unwrap(); for i in 1..x + 1 { if i * i > x { break; } if x % i == 0 { let a = i as f64; let b = (x / i) as f64; if check(a, b, y, z, w) { let ans = x as f64 - y * a / 2. - z * b / 2. - (b - y) * (a - z) / 2.; println!("{:.10}", ans); return; } if check(b, a, y, z, w) { let ans = x as f64 - y * b / 2. - z * a / 2. - (a - y) * (b - z) / 2.; println!("{:.10}", ans); return; } } } }