結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-07-01 14:26:32 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 521 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 01:11:36 |
合計ジャッジ時間 | 2,536 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 33 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d",&L); | ^~~~~~~~~~~~~~ main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d",&N); | ^~~~~~~~~~~~~~ main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d",&W[i]); | ^~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main() { int L,N,W[10000]; int i,j,k; int tmp; int sum=0; int judge; // 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; } } } // if(L==W[0]){ k=1; }else{ for(k=0;judge>0;++k){ sum=sum+W[k]; judge=L-sum; } if(judge<0) k=k-1; } //o printf("%d",k); return 0; }