結果
| 問題 | No.143 豆 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-06-30 09:43:52 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 643 bytes |
| 記録 | |
| コンパイル時間 | 960 ms |
| コンパイル使用メモリ | 172,168 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-03 13:55:55 |
| 合計ジャッジ時間 | 1,453 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv)
{
int K; //一袋当たりの豆の数
int N; //Kを拾った数
int F; //人数
int total1; //K*Nの合計
int total2; //年齢の合計
int i; //ループカウント
int tosi = 0;
//初期化
K = 0;
N = 0;
F = 0;
total1 = 0;
total2 = 0;
tosi = 0;
/*豆の数*/
scanf("%d %d",&K,&N);
total1 = K * N;
/*人数*/
scanf("%d",&F);
for(i = 1;i<=F;i++)
{
scanf("%d",&tosi);
total2 += tosi;
}
if(total1<total2)
{
printf("-1\n");
}
else
{
printf("%d\n",total1-total2);
}
return 0;
}