結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2019-07-11 12:13:08 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 373 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 28,544 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 11:55:15 |
合計ジャッジ時間 | 1,382 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include<stdio.h> #include<stdlib.h> int asc(const void* a, const void* b) { return *(int*)a - *(int*)b; } int main() { int l, n; scanf("%d%d", &l, &n); int i; int w[100004]; for (i = 0; i < n; i++) scanf("%d", &w[i]); qsort(w, n, sizeof(int), asc); int ans = 0; i = 0; while (l - w[i] >= 0) { ans++; l -= w[i]; i++; } printf("%d\n", ans); return 0; }