結果

問題 No.156 キャンディー・ボックス
ユーザー 👑 testestest
提出日時 2015-08-06 19:31:59
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 09:17:36
合計ジャッジ時間 1,180 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
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",&n,&s);c=b=n;
      | ^~~~~~~~~~~~~~~~~~~
main.c:5:11: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 | while(n--)scanf("%d",a+n);
      |           ^~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(){
int a[10],b,n,s,c;
scanf("%d%d",&n,&s);c=b=n;
while(n--)scanf("%d",a+n);
while(b--)for(n=0;n++-b;)a[n-1]>a[n]&&(a[n-1]^=a[n]^=a[n-1]^=a[n]);
while((s-=a[++b])>=0&&b<c);
printf("%d",b);
return 0;
}
0