結果

問題 No.143 豆
ユーザー streingmuststreingmust
提出日時 2017-08-10 00:45:08
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 231 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 05:32:05
合計ジャッジ時間 723 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 1 ms
5,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:8:20: warning: implicit declaration of function 'malloc' [-Wimplicit-function-declaration]
    8 |         A = (int *)malloc(F);
      |                    ^~~~~~
main.c:2:1: note: include '<stdlib.h>' or provide a declaration of 'malloc'
    1 | #include <stdio.h>
  +++ |+#include <stdlib.h>
    2 | 
main.c:8:20: warning: incompatible implicit declaration of built-in function 'malloc' [-Wbuiltin-declaration-mismatch]
    8 |         A = (int *)malloc(F);
      |                    ^~~~~~
main.c:8:20: note: include '<stdlib.h>' or provide a declaration of 'malloc'

ソースコード

diff #

#include <stdio.h>

int main()
{
	int K, N, F, a;
	int *A;
	scanf("%d%d%d", &K, &N, &F);
	A = (int *)malloc(F);
	a = K * N;
	for (int i = 0; i < F; i++)
	{
		a -= *A;
		A++;
	}
	if (a < 0)
		a = -1;
	printf("%d\n", a);
	return 0;
}
0