結果

問題 No.29 パワーアップ
コンテスト
ユーザー rustGanbaruman
提出日時 2026-02-09 14:14:06
言語 Rust
(1.92.0 + proconio + num + itertools)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 649 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,162 ms
コンパイル使用メモリ 201,692 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-02-09 14:14:09
合計ジャッジ時間 2,805 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

use proconio::input;

fn main(){
  input!{
    n:usize,
    mut reward:[usize;n * 3],
  }

  let mut amount = [0;10];
  for i in reward{
    match i {
      1 => amount[0] += 1,
      2 => amount[1] += 1,
      3 => amount[2] += 1,
      4 => amount[3] += 1,
      5 => amount[4] += 1,
      6 => amount[5] += 1,
      7 => amount[6] += 1,
      8 => amount[7] += 1,
      9 => amount[8] += 1,
      10 => amount[9] += 1,
      _ => {},
    }
  }
  let mut level = 0;
  for i in 0..=9{
    while amount[i] >= 2{
      amount[i] -= 2;
      level += 1;
    }
  }
  let rest:usize = amount.iter().sum();
  level += rest / 4;

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