#45932: Andrew Wiggins is so strong that he is the first pick in 2014's draft


1121226@stu.wghs.tp.edu.tw (Arthur✨EC✨小蜜楓)

學校 : 臺北市私立薇閣高級中學
編號 : 252772
來源 : [60.248.154.139]
最後登入時間 :
2025-05-14 12:52:05
f312. 1. 人力分配 -- 2020年10月APCS | From: [60.248.154.143] | 發表日期 : 2025-04-30 16:03

#include <bits/stdc++.h>
using namespace std;
int main() {
    int A1,B1,C1,A2,B2,C2,n,Y1,Y2;
    cin>>A1>>B1>>C1>>A2>>B2>>C2>>n;
    int max=INT_MIN; // 將max設定成int的最小值
    for(int i=0;i<=n;i++){
        Y1=A1*i*i+B1*i+C1; // 計算Y1
        Y2=A2*(n-i)*(n-i)+B2*(n-i)+C2; // 計算Y2
        max=std::max(Y1+Y2,max); // 比較Y1+Y2和max,取較大的值
    }
    cout<<max;
    return 0;
}
 
ZeroJudge Forum