結果

問題 No.143 豆
ユーザー musuchikamusuchika
提出日時 2019-06-04 20:14:42
言語 C++11
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 291 bytes
コンパイル時間 1,125 ms
コンパイル使用メモリ 157,388 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-17 20:51:18
合計ジャッジ時間 1,686 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d%d%d",&k,&n,&f);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:11:13: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |        scanf("%d",&n);
      |        ~~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
//#include<>
using namespace std;

int main(){
    int i,k,n,f,sum;
    scanf("%d%d%d",&k,&n,&f);
    k*=n;
    while(f--){
       scanf("%d",&n);
       sum+=n;
    }
    if(sum<=k)
        return k-sum;
    else
    {
        return -1;
    }
}
0