結果

問題 No.3010 水色コーダーさん
ユーザー 東中出身、涼宮ハルヒ。ただの岩井星人には興味ありません。
提出日時 2025-01-19 11:07:26
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 1,114 bytes
コンパイル時間 26,138 ms
コンパイル使用メモリ 380,468 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-25 21:49:38
合計ジャッジ時間 25,442 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: unused variable: `m`
 --> src/main.rs:8:9
  |
8 |     let m: usize = nums.next().unwrap().parse().unwrap();
  |         ^ help: if this is intentional, prefix it with an underscore: `_m`
  |
  = note: `#[warn(unused_variables)]` on by default

ソースコード

diff #

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let mut nums = input.trim().split_whitespace();
    let n: usize = nums.next().unwrap().parse().unwrap();
    let m: usize = nums.next().unwrap().parse().unwrap();

    let mut ans = 0;

    for _ in 0..n {
        let mut input = String::new();
        io::stdin().read_line(&mut input).unwrap();
        let mut parts = input.trim().split_whitespace();
        let s = parts.next().unwrap();
        let r: i32 = parts.next().unwrap().parse().unwrap();

        // 参加者が1, 2, 3, 4問目のうち少なくとも1問に正解できなかったかを判定
        let mut unsolved = false;
        for c in s.chars().take(4) {
            if r >= 1200 && c == 'x' {
                unsolved = true;
                break; // 条件を満たしたら以降のループは不要
            }
        }

        // 参加者が気絶するか判定し、気絶する場合はansに1を加える
        if r >= 1200 && unsolved {
            ans += 1;
        }
    }

    println!("{}", ans);
}
0