結果

問題 No.143 豆
ユーザー FVRChan
提出日時 2017-09-29 09:21:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 294 bytes
コンパイル時間 649 ms
コンパイル使用メモリ 65,468 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:50:35
合計ジャッジ時間 1,277 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         int k,n,f;scanf("%d%d%d",&k,&n,&f);
      |                   ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%d",&are);
      |                 ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<queue>
#include<cstdio>
#include<utility>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int k,n,f;scanf("%d%d%d",&k,&n,&f);
	int sum=k*n;
	int are;
	for(int i=0;i<f;i++){
		scanf("%d",&are);
		sum-=are;
	}if(sum<0)sum=-1;
	cout<<sum<<endl;
}
0