結果

問題 No.5 数字のブロック
ユーザー 👑 testestest
提出日時 2015-08-05 01:41:59
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 238 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-18 07:29:05
合計ジャッジ時間 2,103 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます
コンパイルメッセージ
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]);
i++;while(j<=l&&i<=n)j+=w[i++];
printf("%d\n",i-1);
return 0;
}
0