kaisyuantseng 题解分享 · 2024/4/11
硬币兑换(结果填空) - 题解
答案为682425,蓝桥杯官网OJ通过,这里不通过,建议改正 ```cpp #include <bits/stdc++.h> using namespace std; #define int long long // #define LL long long #define endl '\n' int coin[4050]; void solve() { for (int i = 1; i <= 2023; i++) coin[i] = i; int res = 0; for (int i = 1; i <= 2023; i++) for (int j = i + 1; j <= 2023; j++) { coin[i + j] += i; // 最大换取数量取决于面值较小的硬币数量 res = max(res, coin[i + j]); } cout << res << endl; } signed main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); solve(); return 0; } ```
查看全文
1 0 0 0