結果
| 問題 |
No.1230 Hall_and_me
|
| コンテスト | |
| ユーザー |
tzyvrn
|
| 提出日時 | 2020-09-18 23:29:44 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 1,045 bytes |
| コンパイル時間 | 11,590 ms |
| コンパイル使用メモリ | 390,992 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 10:26:26 |
| 合計ジャッジ時間 | 12,830 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:10:23 | 10 | let s = s.trim_right(); | ^^^^^^^^^^ ... 38 | let (p, q, r) = getl!(i64, i64, i64); | -------------------- in this macro invocation | = note: `#[warn(deprecated)]` on by default = note: this warning originates in the macro `getl` (in Nightly builds, run with -Z macro-backtrace for more info) help: replace the use of the deprecated method | 10 | let s = s.trim_end(); | ~~~~~~~~
ソースコード
use std::cmp::max;
//{{{
#[allow(unused_macros)]
macro_rules! getl {
( $( $t:ty ),* ) => {
{
let mut s = String::new();
std::io::stdin().read_line(&mut s).unwrap();
let s = s.trim_right();
let mut ws = s.split_whitespace();
($(ws.next().unwrap().parse::<$t>().unwrap()),*)
}
};
}
#[allow(unused_macros)]
macro_rules! getl_vec {
( $t:ty ) => {{
let mut s = String::new();
std::io::stdin().read_line(&mut s).unwrap();
let s = s.trim_right();
s.split_whitespace()
.map(|x| x.parse().unwrap())
.collect::<Vec<$t>>()
}};
}
//}}}
// p + q + r = 1とする
// pを選ぶ
// Stayの場合
// 確率はp
// Changeの場合
// 確率はq + r
fn main() {
let (p, q, r) = getl!(i64, i64, i64);
let mut ans = p;
ans = max(ans, q);
ans = max(ans, r);
ans = max(ans, p + q);
ans = max(ans, q + r);
ans = max(ans, r + p);
println!("{}", (ans as f64) / (p + q + r) as f64);
}
tzyvrn