結果

問題 No.78 クジ付きアイスバー
ユーザー Hissha_Hissha_
提出日時 2018-04-09 16:15:51
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 649 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 29,132 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-09 03:27:26
合計ジャッジ時間 1,785 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 0 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 0 ms
4,384 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,384 KB
testcase_14 AC 0 ms
4,376 KB
testcase_15 AC 0 ms
4,380 KB
testcase_16 AC 0 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 0 ms
4,384 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,384 KB
testcase_26 AC 0 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 0 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:33:18: 警告: 関数 ‘floor’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   33 |         box=(int)floor(k/n);
      |                  ^~~~~
main.c:2:1: 備考: include ‘<math.h>’ or provide a declaration of ‘floor’
    1 | #include <stdio.h>
  +++ |+#include <math.h>
    2 | 
main.c:33:18: 警告: 組み込み関数 ‘floor’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   33 |         box=(int)floor(k/n);
      |                  ^~~~~
main.c:33:18: 備考: include ‘<math.h>’ or provide a declaration of ‘floor’

ソースコード

diff #

#include <stdio.h>

int main(void) {
	// your code goes here
	int n, k, s[50], atari=0, a=0, count=0, box;
	int i;
	char sc[50];
	
	scanf("%d %d", &n, &k);
	scanf("%s", sc);

	for(i=0;i!=n;i++){
		s[i]=(int)(sc[i]-'0');
	}

	for(i=0;i!=n;i++){
		if(atari==0) a++;
		if(atari!=0) atari--;
		atari+=s[i];
	}
	
	if(k<=n){
		printf("%d\n", a);
		return 0;
	}
//	printf("a=%d\n", atari);
//	printf("n=%d\n", n);
	if(atari>=a){
		printf("%d\n", a);
		return 0;
	}
	
	box=(int)floor(k/n);
	
	a*=box;

	for(i=0;i!=k-box*n;i++){
		if(atari==0) a++;
		if(atari!=0) atari--;
		atari+=s[i];
	}
	
//	printf("box=%d\n", box);
	
	printf("%d\n", a);
	
	return 0;
}
0