Submission #1691470


Source Code Expand

#include "bits/stdc++.h"
using namespace std;
int a , b , c , d , e , f;
int num , den;
int main(){
	cin >> a >> b >> c >> d >> e >> f;
	num = 0;
	den = 100 * a;
	for(int i = 0 ; i <= 50 ; ++i){
		for(int j = 0 ; j <= 50 ; ++j){
			int mx = e * (i * a + j * b);
			mx = min(mx , f - (i * a + j * b) * 100);
			if(mx <= 0){
				continue;
			}
			for(int k = 0 ; k * c <= mx ; ++k){
				int rem = mx - k * c;
				int l = (rem / d);
				int newnum = k * c + l * d;
				int newden = newnum + (i * a + j * b) * 100;
				if(newnum * den > num * newden){
					num = newnum;
					den = newden;
				}
			}
		}
	}
	printf("%d %d\n" , den , num);
}

Submission Info

Submission Time
Task C - Sugar Water
User rajat1603
Language C++14 (GCC 5.4.1)
Score 300
Code Size 665 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

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 1 ms 256 KB
02.txt AC 1 ms 256 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 1 ms 256 KB
06.txt AC 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 256 KB
09.txt AC 1 ms 256 KB
subtask0_0.txt AC 1 ms 256 KB
subtask0_1.txt AC 1 ms 256 KB
subtask0_2.txt AC 1 ms 256 KB