結果
問題 |
No.5018 Let's Make a Best-seller Book
|
ユーザー |
![]() |
提出日時 | 2023-10-01 13:31:37 |
言語 | Rust (1.83.0 + proconio) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,543 bytes |
コンパイル時間 | 1,421 ms |
コンパイル使用メモリ | 163,764 KB |
実行使用メモリ | 24,504 KB |
スコア | 0 |
平均クエリ数 | 1.00 |
最終ジャッジ日時 | 2023-10-01 13:31:46 |
合計ジャッジ時間 | 9,004 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | RE * 100 |
コンパイルメッセージ
warning: unused variable: `M_current` --> Main.rs:54:17 | 54 | let M_current = input!(usize); | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_M_current` | = note: `#[warn(unused_variables)]` on by default warning: unused variable: `S` --> Main.rs:55:17 | 55 | let S = input!(usize, N); | ^ help: if this is intentional, prefix it with an underscore: `_S` warning: unused variable: `P` --> Main.rs:56:17 | 56 | let P = input!(isize, N); | ^ help: if this is intentional, prefix it with an underscore: `_P` warning: unused variable: `R` --> Main.rs:57:17 | 57 | let R = input!(usize, N); | ^ help: if this is intentional, prefix it with an underscore: `_R` warning: variable does not need to be mutable --> Main.rs:31:9 | 31 | let mut M = input!(usize); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: variable `T` should have a snake case name --> Main.rs:29:9 | 29 | let T = input!(usize); | ^ help: convert the identifier to snake case: `t` | = note: `#[warn(non_snake_case)]` on by default warning: variable `N` should have a snake case name --> Main.rs:30:9 | 30 | let N = input!(usize); | ^ help: convert the identifier to snake case: `n` warning: variable `M` should have a snake case name --> Main.rs:31:13 | 31 | let mut M = input!(usize); | ^ help: convert the identifier to snake case: `m` warning: variable `C` should have a snake case name --> Main.rs:34:9 | 34 | let C = M / T; | ^ help: convert the identifier to snake case (notice the capitalization): `c` warning: unused `Result` that must be used --> Main.rs:41:13 | 41 | / writeln!( 42 | | out, 43 | | "1 {}", 44 | |
ソースコード
use std::io::{stdin, stdout, BufWriter, Write}; #[derive(Default)] struct Scanner { buffer: Vec<String>, } impl Scanner { fn next<T: std::str::FromStr>(&mut self) -> T { loop { if let Some(token) = self.buffer.pop() { return token.parse().ok().expect("Failed parse"); } let mut input = String::new(); stdin().read_line(&mut input).expect("Failed read"); self.buffer = input.split_whitespace().rev().map(String::from).collect(); } } } fn main() { let mut scan = Scanner::default(); macro_rules! input { ($T: ty) => { scan.next::<$T>() }; ($T: ty, $N: expr) => { (0..$N).map(|_| scan.next::<$T>()).collect::<Vec<_>>() }; } let T = input!(usize); let N = input!(usize); let mut M = input!(usize); // とりあえず一日に使えるお金を均等にしてみる let C = M / T; for _ in 0..T { // output { let out = &mut BufWriter::new(stdout()); writeln!( out, "1 {}", vec![C / N; N] .iter() .map(|x| x.to_string()) .collect::<Vec<_>>() .join(" ") ); } // input { let M_current = input!(usize); let S = input!(usize, N); let P = input!(isize, N); let R = input!(usize, N); } } }