AtCoder Grand Contest 019
题目传送门: AtCoder Grand Contest 019 。 目录 A - Ice Tea Store B - Reverse and Compare C - Fountain Walk D - Shift and Flip E - Shuffle and Swap F - Yes or No A - Ice Tea Store 如果买两瓶 250mL 的冰红茶比买一瓶 500mL 的冰红茶更便宜,就更新它。 同理,用 500mL 的更新 1L 的,用 1L 的更新 2L 的。 最终答案是 \(\lfloor N / 2 \rfloor \times S + (N \bmod 2) \times D\) 。 #include <cstdio> typedef long long LL; int main() { int Q, H, S, D; LL N; scanf("%d%d%d%d%lld", &Q, &H, &S, &D, &N); if (H > 2 * Q) H = 2 * Q; if (S > 2 * H) S = 2 * H; if (D > 2 * S) D = 2 * S; printf("%lld\n", N / 2 * D + N % 2 * S); return 0; } B - Reverse and Compare 如果选取的要 reverse