結果
| 問題 |
No.1057 素敵な日
|
| コンテスト | |
| ユーザー |
vain0
|
| 提出日時 | 2020-05-29 20:46:19 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 967 bytes |
| コンパイル時間 | 16,484 ms |
| コンパイル使用メモリ | 377,276 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 20:14:11 |
| 合計ジャッジ時間 | 14,702 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 |
ソースコード
//! Framework <https://github.com/vain0x/procon>
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::*;
pub struct Scan(Box<dyn Iterator<Item = &'static str>>); // '
impl Scan {
fn new() -> Self {
let mut buf = String::new();
let read_line = move || {
std::io::stdin().read_line(&mut buf).unwrap();
Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace()
};
Scan(Box::new(std::iter::repeat_with(read_line).flatten()))
}
pub fn word<T: std::str::FromStr>(&mut self) -> T {
self.0.next().unwrap().parse().ok().unwrap()
}
pub fn list<T: std::str::FromStr>(&mut self, len: usize) -> Vec<T> {
std::iter::repeat_with(|| self.word()).take(len).collect()
}
}
fn main() {
let mut scan = Scan::new();
let A = scan.word::<usize>();
let B = scan.word::<usize>();
println!("{}", if A == B { A * 2 - 1 } else { A.min(B) * 2 });
}
vain0