Submission #1882179


Source Code Expand

#include<iostream>
#include<string>
#include<algorithm>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <map>
 
using namespace std;
typedef long long LL;
const int INF = int(1e9);
 
double A,B,C,D,E,F;
double Ai,Bi;
double maxx1 = -1,maxx2 = 1;
 
int main()
{
    cin>>A>>B>>C>>D>>E>>F;
    Ai = A*E; Bi = B*E;
    double tan,kefan,sum;
 
    for(int a = 0;a*A*100<=F;a++)
    for(int b = 0;b*B*100<=F-a*A*100;b++)
    for(int c = 0;c*C<=F-a*A*100-b*B*100;c++)
    for(int d = 0;d*D<=F-a*A*100-b*B*100-c*C;d++)
    {
        tan = c*C+d*D;
        sum = A*a*100+B*b*100+tan;
        kefan = Ai*a+Bi*b;
        //cout<<a<<"->"<<b<<" "<<c<<" "<<d<<endl;
       // cout<<sum<<" "<<tan<<" "<<kefan<<endl;
        if(kefan<tan||sum>F)continue;
 
        if(sum!=0&&tan/sum>maxx2/maxx1){
            maxx1 = sum;
            maxx2 = tan;
        }
    }
    cout<<int(maxx1)<<" "<<int(maxx2)<<endl;
    return 0;
}

Submission Info

Submission Time
Task C - Sugar Water
User vjudge3
Language C++14 (GCC 5.4.1)
Score 300
Code Size 976 Byte
Status AC
Exec Time 9 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 2 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 9 ms 256 KB
subtask0_2.txt AC 1 ms 256 KB