結果

問題 No.5 数字のブロック
ユーザー 👑 testestest
提出日時 2015-08-05 01:30:06
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 232 bytes
コンパイル時間 117 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-18 01:22:07
合計ジャッジ時間 2,076 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 32
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 | scanf("%d%d",&l,&n);
      | ^~~~~~~~~~~~~~~~~~~
main.c:5:14: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | for(;i<n;i++)scanf("%d",w+i);
      |              ^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
int l,n,w[10000],i=0,j;
scanf("%d%d",&l,&n);
for(;i<n;i++)scanf("%d",w+i);
while(i--)for(j=0;j<i;j++)w[j]>w[j+1]&&(w[j]^=w[j+1]^=w[j]^=w[j+1]);
while(j<=l){j+=w[i];i++;}
printf("%d\n",i-1);
return 0;
}
0