版本比较
【HT-017-Div.4】核桃新手组周赛寄
正文
增加 4 行删除 4 行
108 行未改动全部展开109110111112113113114115116117119 行未改动全部展开2372382392402412412422432432442452462473 行未改动251252253254255255256257108 行未改动全部展开 while (!num.empty()) { auto maxnum = max_element(num.begin(), num.end(), [](const pair<int, int>& a, const pair<int, int>& b) { return a.second < b.second; }); //干脆改auto得了 }); //干脆改auto得了 ans++; int maxt = maxnum->first; num.erase(maxt); }119 行未改动全部展开
一直以为是数学问题,结果写了5次都没过,后来才发现 $1\leq n \leq 500$ 直接枚举即可。看来是真唐了,$O(n^2)$ 稳过好吧。
```cpp#include <iostream> #include <iostream>using namespace std;int main() { int main() { int n, ans = 0; cin >> n; for (int i = 1; i <= n-2; i++) {3 行未改动 ans = max(i*j*k, ans); } } cout << ans; return 0; return 0;}```