結果
| 問題 |
No.2386 Udon Coupon (Easy)
|
| コンテスト | |
| ユーザー |
tabr
|
| 提出日時 | 2023-07-21 22:06:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 2,000 ms |
| コード長 | 955 bytes |
| コンパイル時間 | 2,079 ms |
| コンパイル使用メモリ | 200,644 KB |
| 最終ジャッジ日時 | 2025-02-15 16:57:15 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n;
cin >> n;
vector<pair<int, int>> c(3);
c[0].first = 3;
c[1].first = 5;
c[2].first = 10;
for (int i = 0; i < 3; i++) {
cin >> c[i].second;
}
sort(c.begin(), c.end(), [&](auto x, auto y) {
return x.second * y.first < y.second * x.first;
});
vector<long long> a(3), b(3);
for (int i = 0; i < 3; i++) {
a[i] = c[i].first;
b[i] = c[i].second;
}
long long ans = 0;
for (int i = 0; i < 2023; i++) {
for (int j = 0; j < 2023; j++) {
if (a[0] * i + a[1] * j > n) {
break;
}
ans = max(ans, b[0] * i + b[1] * j + b[2] * ((n - a[0] * i - a[1] * j) / a[2]));
}
}
cout << ans << '\n';
return 0;
}
tabr