結果
問題 | No.1305 Speak of the Devil |
ユーザー | 👑 terry_u16 |
提出日時 | 2020-12-05 11:57:31 |
言語 | Rust (1.77.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,635 bytes |
コンパイル時間 | 1,428 ms |
コンパイル使用メモリ | 150,224 KB |
実行使用メモリ | 8,696 KB |
最終ジャッジ日時 | 2023-10-13 21:22:50 |
合計ジャッジ時間 | 31,233 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 1,504 ms
4,348 KB |
testcase_03 | WA | - |
testcase_04 | AC | 1,501 ms
4,352 KB |
testcase_05 | AC | 1,501 ms
4,352 KB |
testcase_06 | AC | 1,503 ms
4,352 KB |
testcase_07 | AC | 1,509 ms
4,348 KB |
testcase_08 | AC | 1,503 ms
4,376 KB |
testcase_09 | AC | 1,501 ms
4,348 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 1,504 ms
4,352 KB |
testcase_13 | AC | 1,506 ms
4,348 KB |
testcase_14 | AC | 1,503 ms
4,352 KB |
testcase_15 | AC | 1,508 ms
4,352 KB |
testcase_16 | TLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
ソースコード
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes .by_ref() .map(|r|r.unwrap() as char) .skip_while(|c|c.is_whitespace()) .take_while(|c|!c.is_whitespace()) .collect() }; input_inner!{next, $($r)*} }; } macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; } macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; } fn main() { input! { p: f64, q: f64 } let p = (p - 1.0) / p; let mut exp = 0.0; let mut prob = 1.0; for _ in 0..1000000000 { exp += prob; prob *= p; } println!("{}", f64::min(exp, q)); }