結果
問題 | No.5 数字のブロック |
ユーザー |
|
提出日時 | 2022-11-08 00:36:21 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 183 ms / 5,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 750 ms |
コンパイル使用メモリ | 28,800 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 07:26:01 |
合計ジャッジ時間 | 2,753 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include<stdio.h>int main(void){int L;int N;int W[10000];int i, j, tmp;int number=0, cnt=0;scanf("%d", &L);scanf("%d", &N);for (i=0; i<N; i++){scanf("%d", &W[i]);}for (i=0; i<N; i++){for (j=i+1; j<N; j++){if (W[i] > W[j]) {tmp = W[i];W[i] = W[j];W[j] = tmp;}}}for (i=0; i<N; i++){number = number + W[i];if (L<number){break;}cnt = cnt+1;}printf("%d",cnt);}