Submission #1866748
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) FOR(i,0,n) #define pb push_back #define mp make_pair typedef long long ll; typedef pair<int,int> pint; vector<int> vs,vw; int main(){ int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f; int w=0; int sw=f/(100+e)*(e+1); for(int i=0;i*100*a<=f;++i){ for(int j=0;j*100*b<=f;++j){ if(i*100*a+j*100*b<=f&&(i!=0||j!=0)){ vw.pb(i*100*a+j*100*b); } } } for(int i=0;i*c<=sw;++i){ for(int j=0;j*d<=sw;++j){ if(i*c+j*d<=sw){ vs.pb(i*c+j*d); } } } int fw,s; double con=-1; rep(i,vw.size())rep(j,vs.size()){ if(vw[i]+vs[j]<=f){ if(con*(vw[i]+vs[j])<100*vs[j]&&(double)vw[i]/100*e>=vs[j]){ con=(double)(100*vs[j])/(vw[i]+vs[j]); fw=vw[i]+vs[j];s=vs[j]; } } } cout<<fw<<" "<<s<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Sugar Water |
User | ts_ |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1059 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 5 ms | 640 KB |
subtask0_2.txt | AC | 1 ms | 256 KB |