結果

問題 No.5 数字のブロック
ユーザー neeet
提出日時 2017-06-15 03:39:38
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 354 ms
コンパイル使用メモリ 29,312 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-25 00:19:36
合計ジャッジ時間 1,432 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void)
{
  int l, n, i, j, cnt = 0, sum = 0;

  scanf("%d%d", &l, &n);
  int w[n];
  for(i = 0; i < n; i++)
    scanf("%d", &w[i]);
  for(i = 1; cnt < n; i++){
    for(j = 0; j < n; j++){
      if(w[j] == i){
        sum += i;
        if(sum > l){
          printf("%d\n", cnt);
          return 0;
        }
        cnt++;
      }
    }
  }
}
0