#45812: cpp 超級簡單解


1121232@stu.wghs.tp.edu.tw (Ian911436)

學校 : 臺北市私立薇閣高級中學
編號 : 258883
來源 : [60.248.154.143]
最後登入時間 :
2025-05-14 15:36:23
m396. 煲仔飯 (ClayPotRice) -- TOI練習賽202310新手組第1題 | From: [60.248.154.139] | 發表日期 : 2025-04-16 12:50

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;
    int sum = b + c + d + e;
    if(a >= sum){
        cout << sum;
    }
    else{
        cout << "-1";
    }
    return 0;
}

 

 
ZeroJudge Forum