CodeForces 1992A Only Pluses

薛定谔的AC發表於2024-07-16

題目連結:CodeForces 1992A【Only Pluses】



思路


程式碼

#include <functional>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
#define ll long long
const int N = 500 + 10;

int a[N];
void solve() {
  int n, m = 5;
  priority_queue<int> q;
  for (int i = 1; i <= 3; i++) {
    cin >> a[i];
  }

  int res = 1;
  for (int i = 0; i <= 5; i++) {
    for (int j = 0; i + j <= 5; j++) {
      for (int k = 0; i + j + k <= 5; k++) {
        res = max(res, (a[1] + i) * (a[2] + j) * (a[3] + k));
      }
    }
  }
  cout << res << endl;
}

int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}

相關文章