結果
| 問題 |
No.2386 Udon Coupon (Easy)
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2023-07-25 10:42:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 843 bytes |
| コンパイル時間 | 406 ms |
| コンパイル使用メモリ | 42,436 KB |
| 実行使用メモリ | 6,816 KB |
| 最終ジャッジ日時 | 2024-10-02 05:08:23 |
| 合計ジャッジ時間 | 1,725 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 WA * 3 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2386.cc: No.2386 Udon Coupon (Easy) - yukicoder
*/
#include<cstdio>
#include<algorithm>
using namespace std;
/* constant */
const int M = 30;
/* typedef */
/* global variables */
int dp[M + 1];
/* subroutines */
inline void setmax(int &a, int b) { if (a < b) a = b; }
/* main */
int main() {
int n, a, b, c;
scanf("%d%d%d%d", &n, &a, &b, &c);
int q = n / M, r = n % M;
fill(dp, dp + M + 1, -1);
dp[0] = 0;
for (int i = 0; i + 3 <= r; i++)
if (dp[i] >= 0) setmax(dp[i + 3], dp[i] + a);
for (int i = 0; i + 5 <= r; i++)
if (dp[i] >= 0) setmax(dp[i + 5], dp[i] + b);
for (int i = 0; i + 10 <= r; i++)
if (dp[i] >= 0) setmax(dp[i + 10], dp[i] + c);
int x =
max(max(10 * a, 6 * b), 3 * c) * q +
*max_element(dp, dp + r + 1);
printf("%d\n", x);
return 0;
}
tnakao0123