#27538: CPP


qgd20040229@gmail.com (时年)

學校 : 不指定學校
編號 : 170559
來源 : [27.105.55.178]
最後登入時間 :
2021-10-10 23:00:28
f312. 1. 人力分配 -- 2020年10月APCS | From: [27.105.55.178] | 發表日期 : 2021-10-10 23:47

#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