結果
問題 | No.634 硬貨の枚数1 |
ユーザー | aimy |
提出日時 | 2018-01-19 21:53:16 |
言語 | Rust (1.77.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,448 bytes |
コンパイル時間 | 13,722 ms |
コンパイル使用メモリ | 383,084 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-07 14:05:30 |
合計ジャッジ時間 | 15,488 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,812 KB |
testcase_02 | AC | 1 ms
6,816 KB |
testcase_03 | WA | - |
testcase_04 | AC | 0 ms
6,940 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 1 ms
6,944 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | WA | - |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 1 ms
6,944 KB |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | AC | 1 ms
6,944 KB |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | WA | - |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | WA | - |
testcase_76 | WA | - |
testcase_77 | AC | 1 ms
6,940 KB |
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:40:9 | 40 | buf.trim_right().parse::<T>().ok().unwrap() | ^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default help: replace the use of the deprecated method | 40 | buf.trim_end().parse::<T>().ok().unwrap() | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:56:22 | 56 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 56 | let mut it = buf.trim_end().split_whitespace(); | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:75:22 | 75 | let mut it = buf.trim_right().split_whitespace(); | ^^^^^^^^^^ | help: replace the use of the deprecated method | 75 | let mut it = buf.trim_end().split_whitespace(); | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:95:9 | 95 | buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 95 | buf.trim_end().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() | ~~~~~~~~ warning: use of deprecated method `core::str::<impl str>::trim_right`: superseded by `trim_end` --> src/main.rs:111:9 | 111 | buf.trim_right().chars().collect() | ^^^^^^^^^^ | help: replace the use of the deprecated method | 111 | buf.trim_end().chars().collect() | ~~~~~~~~
ソースコード
#![allow(unused_imports, unused_macros, unknown_lints)] use std::collections::*; use std::cmp::Ordering::*; macro_rules! dump {($($e:expr), +) => {print!(concat!($(stringify!($e), " = {:?}\n"), +), $($e), +)}} macro_rules! max {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = std::cmp::max(r, $e);)+ r}}} macro_rules! min {($e0:expr, $($e:expr), +) => {{let mut r = $e0; $(r = std::cmp::min(r, $e);)+ r}}} fn main() { let mut n = get::val::<usize>(); let mut cs = (1usize..n+1).map(|x|x*(x+1)/2).take_while(|&x|x<=n).collect::<Vec<_>>(); let mut ans = 0; while n > 0 { let m = cs[cs.len()-1]; if m > n { let _ = cs.pop(); continue } else { n -= m; ans += 1; } } println!("{}", ans) } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; use std::process::*; pub fn val<T: FromStr>() -> T { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().parse::<T>().ok().unwrap() } pub fn vals<T: FromStr>(n: usize) -> Vec<T> { let mut vec: Vec<T> = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); (x, y) } pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} let mut it = buf.trim_right().split_whitespace(); let x = it.next().unwrap().parse::<T1>().ok().unwrap(); let y = it.next().unwrap().parse::<T2>().ok().unwrap(); let z = it.next().unwrap().parse::<T3>().ok().unwrap(); (x, y, z) } pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn vec<T: FromStr>() -> Vec<T> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect() } pub fn mat<T: FromStr>(h: usize) -> Vec<Vec<T>> { let mut mat = vec![]; for _ in 0 .. h { mat.push(vec()); } mat } pub fn chars() -> Vec<char> { let mut buf = String::new(); let s = stdin(); s.lock().read_line(&mut buf).ok(); if buf.is_empty() {println!("No input"); exit(0)} buf.trim_right().chars().collect() } } #[allow(dead_code)] mod put { use std::string::*; pub fn vec<T: ToString>(vec: &Vec<T>, sep: &str) { let out = vec.iter().map(|e| e.to_string()).collect::<Vec<_>>().as_slice().join(sep); println!("{}", out); } pub fn mat<T: ToString>(mat: &Vec<Vec<T>>, sep: &str) { for v in mat { vec(v, sep); } } }