結果
| 問題 |
No.1656 Recuperation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-08 14:57:49 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 1,376 bytes |
| コンパイル時間 | 12,481 ms |
| コンパイル使用メモリ | 378,168 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-23 14:41:32 |
| 合計ジャッジ時間 | 13,137 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 |
ソースコード
#[allow(dead_code)]
pub mod ut {
pub type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>;
pub mod input {
use super::Result;
use std::{error::Error, str::FromStr};
pub fn string() -> Result<String> {
let mut buf = String::new();
std::io::stdin()
.read_line(&mut buf)
.map_err(|e| e.into())
.map(|_| buf.trim().to_string())
}
pub fn single<T: FromStr>() -> Result<T>
where
<T as FromStr>::Err: Error + 'static,
{
string().and_then(|x| x.parse::<T>().map_err(|e| e.into()))
}
pub fn vector<T: FromStr>() -> Result<Vec<T>>
where
<T as FromStr>::Err: Error + 'static,
{
string()?
.split_ascii_whitespace()
.map(|x| x.parse::<T>().map_err(|e| e.into()))
.collect()
}
pub fn double<T: FromStr + Copy>() -> Result<(T, T)>
where
<T as FromStr>::Err: Error + 'static,
{
let v = vector::<T>()?;
Ok((v[0], v[1]))
}
}
}
fn main() -> ut::Result {
let t = ut::input::single::<usize>()?;
for _ in 1..=t {
let (a, b) = ut::input::double::<usize>()?;
println!("{}", a * b + b);
}
Ok(())
}