#27497: CPP


11030067@mail.hpsh.tp.edu.tw (和平110級鄧雨珊)

學校 : 臺北市立和平高級中學
編號 : 163096
來源 : [61.64.210.174]
最後登入時間 :
2022-10-23 16:54:59
f312. 1. 人力分配 -- 2020年10月APCS | From: [27.105.55.178] | 發表日期 : 2021-10-10 11:20

#include<iostream>
#include <climits>
using namespace std;

int main(){
int a1, b1, c1, a2, b2, c2, n;
cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2 >> n;
int ans=-INT_MAX;
for (int x1=0; x1<=n; x1++){
int x2=n-x1;
int y1=a1*x1*x1+b1*x1+c1;
int y2=a2*x2*x2+b2*x2+c2;
ans=max(ans, y1+y2);
}
cout << ans <<endl;
}
 
ZeroJudge Forum