# ZeroJudge - f312: 1.人力分配 ### 題目連結:https://zerojudge.tw/ShowProblem?problemid=f312 ###### tags: `ZeroJudge` `窮舉` `數學` ```cpp= #include <iostream> #include <algorithm> using namespace std; #define SQUARE(x) (x * x) int main() { cin.sync_with_stdio(false), cin.tie(nullptr); int A1, A2, B1, B2, C1, C2, employees, maximum = 1 << 31; cin >> A1 >> B1 >> C1 >> A2 >> B2 >> C2 >> employees; for (int i = 0; i <= employees; ++i) maximum = max(maximum, A1 * SQUARE(i) + B1 * i + C1 + A2 * SQUARE((employees - i)) + B2 * (employees - i) + C2); cout << maximum << '\n'; } ```