結果
| 問題 | 
                            No.156 キャンディー・ボックス
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Haijinn
                         | 
                    
| 提出日時 | 2017-01-25 20:30:53 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 497 bytes | 
| コンパイル時間 | 381 ms | 
| コンパイル使用メモリ | 21,504 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-12-23 09:44:15 | 
| 合計ジャッジ時間 | 1,180 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 4 | 
| other | WA * 30 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:20:27: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
   20 |                 scanf("%lld",&c[i]);
      |                        ~~~^  ~~~~~
      |                           |  |
      |                           |  int *
      |                           long long int *
      |                        %d
main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         scanf("%d%lld",&n,&m);
      |         ^~~~~~~~~~~~~~~~~~~~~
main.c:20:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |                 scanf("%lld",&c[i]);
      |                 ^~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include<stdio.h>
int main(){
	
	int n;
	long long m;
	int i;
	int j;
	int temp;
	int b;
	int c[100000];
	int a=0;
	int f=0;
	scanf("%d%lld",&n,&m);
	for(i=0;i<n;i++){
		
		scanf("%lld",&c[i]);
	}
	for(i=0;i<n;i++){
		
		for(j=n-1;j>i;j--){
			if(c[j]>c[j-1]){
				temp=c[j];
				c[j]=c[j-1];
				c[j-1]=temp;
			}
		}
		
		
		
		
	}
	for(i=n-1;i>=0;i--){
		f+=c[n];
		printf("f=%d\n",c[i]);
		if(f>=m){break;}
		a++;
		printf("a=%d\n",a);
	
		
	}
	
	printf("%d\n",a);
	
	
	
	
	
	return 0;
}
            
            
            
        
            
Haijinn