Submission #1599784
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0) typedef long long ll; typedef long double ld; const ll inf = (ll)1e14; const ll N = (ll)1e6; ll arr[6]; ld ret; ll sol,sugar; int main() { fast; for (int i = 0; i < 6; i++) cin >> arr[i]; arr[0] = 100 * arr[0]; arr[1] = 100 * arr[1]; for (ll i = 0; i * arr[0] <= arr[5]; i++) { for (ll j = 0; i * arr[0] + j * arr[1] <= arr[5]; j++) { ll water = i * arr[0] + j * arr[1]; for (ll p = 0; p * arr[2] * 100 <= arr[4] * water and (p * arr[2] + water) <= arr[5]; p++) { for (ll q = 0; (p * arr[2] + q * arr[3]) * 100 <= arr[4] * water and (p * arr[2] + q * arr[3] + water) <= arr[5]; q++) { ll sug = p * arr[2] + q * arr[3]; if (ret < ld(sug) * 100 / (water + sug)) { ret = ld(sug) * 100 / (water + sug); sol = water + sug; sugar = sug; } } } } } // cout << ret << endl; if (!sol) sol = arr[0]; cout << sol << " " << sugar << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Sugar Water |
User | gtpan77 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1299 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 256 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 | 256 KB |
subtask0_2.txt | AC | 1 ms | 256 KB |