結果

問題 No.5 数字のブロック
ユーザー Tosuke
提出日時 2016-04-09 21:24:39
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 305 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 105,268 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-12 03:26:09
合計ジャッジ時間 1,744 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.conv, std.string, std.range, std.array, std.algorithm;

int main(){
	auto L = readln.strip.to!int;
	auto N = readln.strip.to!int;
	auto A = readln.strip.split.to!(int[]).sort!("a<b");
	
	int cnt = 0;
	foreach(int a; A){
		L-=a;
		if(L<0) break;
		cnt++;
	}
	cnt.writeln;
	return 0;
}
0