結果

問題 No.143 豆
ユーザー funakoshi
提出日時 2019-08-09 13:58:05
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 29,440 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-07-19 06:44:59
合計ジャッジ時間 937 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    int beaninbag,bag,numoffam;
    int age[120]={0};
    scanf("%d %d %d",&beaninbag,&bag,&numoffam);
    int totalbean=beaninbag*bag;
    for(int i=0;i<numoffam;i++)
    {
        scanf("%d",&age[i]);
    }
    for(int i=0;i<numoffam;i++)
    {
        totalbean-=age[i];
        if(totalbean<=0)
        {
            break;
        }
    }
    if(totalbean<=0)
    {
        printf("-1");
    }
    else
    {
        printf("%d",totalbean);
    }
    
}

0