結果
問題 |
No.5 数字のブロック
|
ユーザー |
👑 ![]() |
提出日時 | 2015-08-05 01:37:05 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 236 bytes |
コンパイル時間 | 156 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 01:22:13 |
合計ジャッジ時間 | 2,414 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
コンパイルメッセージ
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); | ^~~~~~~~~~~~~~~
ソースコード
#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=0;while(j<=l){j+=w[i];i++;} printf("%d\n",i-1); return 0; }