結果

問題 No.3100 始業式
ユーザー so-heyso-hey
提出日時 2023-05-28 13:09:25
言語 Rust
(1.77.0)
結果
WA  
実行時間 -
コード長 1,121 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 147,980 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-27 07:37:57
合計ジャッジ時間 1,466 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: function `input_chars` is never used
 --> Main.rs:7:4
  |
7 | fn input_chars() -> Vec<char> {
  |    ^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

warning: function `input_nums` is never used
  --> Main.rs:13:4
   |
13 | fn input_nums() -> (usize, f64, f64) {
   |    ^^^^^^^^^^

warning: 2 warnings emitted

ソースコード

diff #

fn input_num() -> usize {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().parse().unwrap()
}

fn input_chars() -> Vec<char> {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().chars().collect()
}

fn input_nums() -> (usize, f64, f64) {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let mut iter = line.split_whitespace();
    (
        iter.next().unwrap().parse().unwrap(),
        iter.next().unwrap().parse().unwrap(),
        iter.next().unwrap().parse().unwrap()
    )
}

fn input_vec_nums() -> Vec<usize> {
    let mut line: String = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let t = input_num();
    for _ in 0..t {
        let n = input_num();
        let f = input_vec_nums();
        let mut ans = 0;
        for i in 0..n {
            if f[i] == 1 { ans += 1 }
        }
        println!("{}", ans);
    }
}
0