結果
問題 | No.9008 空白区切りで与えられる数値データの合計値を求める(テスト用) |
ユーザー | mai |
提出日時 | 2021-04-21 01:41:59 |
言語 | Rust (1.77.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 1,001 bytes |
コンパイル時間 | 677 ms |
コンパイル使用メモリ | 147,380 KB |
実行使用メモリ | 5,820 KB |
最終ジャッジ日時 | 2023-09-17 09:21:17 |
合計ジャッジ時間 | 1,923 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 1 ms
4,376 KB |
testcase_05 | AC | 1 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 4 ms
4,376 KB |
testcase_08 | AC | 18 ms
4,376 KB |
testcase_09 | AC | 14 ms
4,380 KB |
testcase_10 | AC | 31 ms
5,048 KB |
testcase_11 | AC | 33 ms
5,052 KB |
testcase_12 | AC | 33 ms
5,108 KB |
testcase_13 | AC | 34 ms
5,260 KB |
testcase_14 | AC | 34 ms
5,304 KB |
testcase_15 | AC | 36 ms
5,308 KB |
testcase_16 | AC | 39 ms
5,820 KB |
testcase_17 | AC | 1 ms
4,376 KB |
testcase_18 | AC | 1 ms
4,380 KB |
コンパイルメッセージ
warning: unused import: `collections::*` --> Main.rs:1:30 | 1 | use std::{borrow::BorrowMut, collections::*, io::Read}; | ^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default warning: 1 warning emitted
ソースコード
use std::{borrow::BorrowMut, collections::*, io::Read}; struct Scanner<R: std::io::BufRead>(R); impl<R: std::io::BufRead> Scanner<R> { fn new(input: R) -> Self { Self(input) } fn take(&mut self) -> String { self.0 .borrow_mut() .bytes() .map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect::<String>() } } #[allow(unused)] macro_rules! scan { ($io:expr => $t:ty) => ($io.take().parse::<$t>().unwrap()); ($io:expr => $t:tt * $n:expr) => ((0..$n).map(|_| scan!($io => $t)).collect::<Vec<_>>()); ($io:expr => $($t:tt),*) => (($(scan!($io => $t)),*)); } fn main() { solve(Scanner::<std::io::StdinLock>::new(std::io::stdin().lock())) } fn solve<R: std::io::BufRead>(mut cin: Scanner<R>) { let n = scan!(cin => i32); let aa = scan!(cin => i64 * n); let total = aa.iter().sum::<i64>(); println!("{}", total); }