結果

問題 No.2424 Josouzai
ユーザー hnkz
提出日時 2023-08-31 13:31:22
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 23,403 ms
コンパイル使用メモリ 383,672 KB
実行使用メモリ 7,040 KB
最終ジャッジ日時 2025-01-03 04:34:31
合計ジャッジ時間 18,963 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
warning: variable `N` should have a snake case name
 --> src/main.rs:6:9
  |
6 |         N: usize,
  |         ^ help: convert the identifier to snake case: `n`
  |
  = note: `#[warn(non_snake_case)]` on by default

warning: variable `K` should have a snake case name
 --> src/main.rs:7:13
  |
7 |         mut K: usize,
  |             ^ help: convert the identifier to snake case (notice the capitalization): `k`

warning: variable `A` should have a snake case name
 --> src/main.rs:8:13
  |
8 |         mut A: [usize; N],
  |             ^ help: convert the identifier to snake case: `a`

ソースコード

diff #

use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        N: usize,
        mut K: usize,
        mut A: [usize; N],
    }

    let mut num_tochi = 0;

    A.sort_by(|a, b| a.cmp(b));

    for a in A.iter() {
        if *a < K {
            num_tochi += 1;
            K -= *a;
        } else {
            break;
        }
    }

    println!("{} {}", num_tochi, K);
}
0