結果

問題 No.156 キャンディー・ボックス
ユーザー Haijinn
提出日時 2017-01-25 19:58:36
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 09:44:12
合計ジャッジ時間 1,384 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 20 WA * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:14:19: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
   14 |         scanf("%lld%lld",&n,&m);
      |                ~~~^      ~~
      |                   |      |
      |                   |      int *
      |                   long long int *
      |                %d
main.c:17:27: warning: format ‘%lld’ expects argument of type ‘long long int *’, but argument 2 has type ‘int *’ [-Wformat=]
   17 |                 scanf("%lld",&c[i]);
      |                        ~~~^  ~~~~~
      |                           |  |
      |                           |  int *
      |                           long long int *
      |                        %d
main.c:27:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=]
   27 |         printf("%lld\n",f);
      |                 ~~~^    ~
      |                    |    |
      |                    |    int
      |                    long long int
      |                 %d
main.c:14:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%lld%lld",&n,&m);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
main.c:17:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |                 scanf("%lld",&c[i]);
      |                 ^~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>




int main(){
	
	int n;
	long long m;
	int i;
	int c[100000];
	int a=0;
	int f=0;
	scanf("%lld%lld",&n,&m);
	for(i=0;i<n;i++){
		
		scanf("%lld",&c[i]);
	}
	
	for(i=0;i<n;i++){
		
		a+=c[i];
		f++;
		if(a>=m) {break;}

	}
	printf("%lld\n",f);
	
	
	
	
	
	return 0;
}
0