Submission #1597600


Source Code Expand

#include <iostream>

using namespace std;

bool b[3001][3001];

int main() {
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;

	for (int i = 0; i < 3001; i++)
		for (int j = 0; j < 3001; j++)
			b[i][j] = false;

	b[0][0] = true;
	for (int i = 0; i < 3001; i++) {
		for (int j = 0; j <= i; j++) {
			if (b[i][j]) {
				if (i + 100 * A <= 3000) b[i + 100 * A][j] = true;
				if (i + 100 * B <= 3000) b[i + 100 * B][j] = true;
				if (i + C <= 3000) b[i + C][j + C] = true;
				if (i + D <= 3000) b[i + D][j + D] = true;
			}
		}
	}

	int ans1 = 0, ans2 = 0;
	double max = 0;
	for (int i = 1; i <= F; i++) {
		for (int j = 0; j <= i; j++) {
			double c = j * 100.0 / ((double)i);
			if (b[i][j] && 100.0 * j <= E * (i - j)) {
				if (max <= c) {
					max = c;
					ans1 = i;
					ans2 = j;
				}
			}
		}
	}
	cout << ans1 << " " << ans2 << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Sugar Water
User tmg_58
Language C++14 (GCC 5.4.1)
Score 300
Code Size 910 Byte
Status AC
Exec Time 13 ms
Memory 9088 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 12
Set Name Test Cases
Sample subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt
Case Name Status Exec Time Memory
01.txt AC 10 ms 9088 KiB
02.txt AC 12 ms 9088 KiB
03.txt AC 11 ms 9088 KiB
04.txt AC 12 ms 9088 KiB
05.txt AC 13 ms 9088 KiB
06.txt AC 12 ms 9088 KiB
07.txt AC 11 ms 9088 KiB
08.txt AC 12 ms 9088 KiB
09.txt AC 10 ms 9088 KiB
subtask0_0.txt AC 10 ms 9088 KiB
subtask0_1.txt AC 11 ms 9088 KiB
subtask0_2.txt AC 12 ms 9088 KiB