結果

問題 No.143 豆
ユーザー cande398
提出日時 2018-03-26 21:54:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 138 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 22,400 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:56:24
合計ジャッジ時間 710 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    2 | main()
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d%d%d",&K,&N,&F);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |                 scanf("%d",&K);N-=K;
      |                 ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
main()
{
	int N,K,F;
	scanf("%d%d%d",&K,&N,&F);
	for(N=K*N;F--;){
		scanf("%d",&K);N-=K;
	}
	printf("%d\n",N<0?-1:N);
}
0