結果
| 問題 |
No.948 Bomb vs Dush
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-01-21 00:04:04 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 666 bytes |
| コンパイル時間 | 15,383 ms |
| コンパイル使用メモリ | 379,612 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 23:18:51 |
| 合計ジャッジ時間 | 15,107 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
use std::io::Read;
use std::f64::consts::PI;
fn main() {
let mut all_data = String::new();
std::io::stdin().read_to_string(&mut all_data).ok();
let all_data: Vec<&str> = all_data.trim().split('\n').collect();
let sr: f64 = all_data.iter().next().unwrap().parse::<f64>().unwrap();
let lr: f64 = all_data.iter().skip(1).next().unwrap().parse::<f64>().unwrap();
let cos_theta: f64 = (lr*lr - 2.0*sr*sr) / (lr*lr);
let theta: f64 = cos_theta.acos();
let circle: f64 = sr * sr * PI;
let curv: f64 = ((lr+sr)*(lr+sr) - (lr-sr)*(lr-sr)) * (2.0*PI - theta) / 2.0;
println!("{}", 2.0*PI - theta);
println!("{}", circle + curv);
}