結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2016-12-24 14:39:13 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 455 bytes |
コンパイル時間 | 250 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-14 17:23:08 |
合計ジャッジ時間 | 3,910 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 10 RE * 21 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:22:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d",&l); | ^~~~~~~~~~~~~~ main.c:23:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:25:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | scanf("%d",&w[i]); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { int n; int a[100]; int b[100]; int w[100]; int i; int f; int d=0; int j=0; int k=0; int r=0; int p; int l; int q=0; int temp; scanf("%d",&l); scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&w[i]); } for(j=0;j<n-1;j++){ for(p=n-1;p>j;p--){ if(w[p-1]>w[p]){ temp=w[p]; w[p]=w[p-1]; w[p-1]=temp; } } } for(f=0;f<n;f++){ d+=w[f];q++; if(d>=l){ break; } } printf("%d\n",q-1); return 0; }