結果

問題 No.5 数字のブロック
ユーザー NakLon131
提出日時 2024-05-26 22:12:58
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 948 bytes
コンパイル時間 13,379 ms
コンパイル使用メモリ 401,348 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-20 20:27:42
合計ジャッジ時間 14,815 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused)]
use proconio::{input, marker::Chars, marker::Usize1};
#[allow(unused)]
use std::{
	mem::swap,
	cmp::min, cmp::max,
	cmp::Reverse,
	collections::HashSet, collections::BTreeSet,
	collections::HashMap, collections::BTreeMap,
	collections::BinaryHeap,
	collections::VecDeque,
	iter::FromIterator,
};
// #[allow(unused)]
// use itertools::{
// 	Itertools, 
// };
// #[allow(unused)]
// use num::integer::gcd;
// #[allow(unused)]
// use superslice::Ext;

// #[allow(unused)]
// use ac_library::{
// 	Dsu,
// 	FenwickTree
// };
// const MOD17: usize = 1000000007;
// const MOD93: usize = 998244353;
// const INF: usize = 1 << 60;
// let dx = vec![!0, 0, 1, 0]; // 上左下右
// let dy = vec![0, !0, 0, 1]; // 上左下右

fn main() {
    input!{
		l: usize,
		n: usize,
		mut w: [usize; n],
	}
	w.sort();

	let mut cnt = 0;
	let mut tot = 0;
	while cnt < n && tot + w[cnt] <= l {
		tot += w[cnt];
		cnt += 1;
	}
	println!("{}", cnt);
}
0