Submission #3428214
Source Code Expand
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; public class Main { final static String SHORT = "0.25"; final static String TALL = "0.5"; final static String GRANDE = "1"; final static String VENTI = "2"; public static void main(String[] args)throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader(System.in)); String [] input = br.readLine().split(" "); String input2 = br.readLine(); HashMap<String,Integer> iceTeaMap = new HashMap<String,Integer>(); iceTeaMap.put(SHORT,Integer.parseInt(input[0])); iceTeaMap.put(TALL,Integer.parseInt(input[1])); iceTeaMap.put(GRANDE,Integer.parseInt(input[2])); iceTeaMap.put(VENTI,Integer.parseInt(input[3])); int max = Integer.parseInt(input2); long first =(long)( max / Double.parseDouble(SHORT)); long second = 0; long third = 0; long forth = 0; //long sf = iceTeaMap.get(TALL)/iceTeaMap.get(SHORT); if(iceTeaMap.get(SHORT)*2 > iceTeaMap.get(TALL) ) { second = first/2; first = first%2; } if(second > 0) { if(iceTeaMap.get(TALL)*2 > iceTeaMap.get(GRANDE)) { third = second/2; second = second%2; } }else { if(iceTeaMap.get(SHORT)*4 > iceTeaMap.get(GRANDE)) { third = first/4; first = first%4; } } if(third > 0) { if(iceTeaMap.get(GRANDE)*2 > iceTeaMap.get(VENTI)) { forth = third/2; third = third%2; } }else if(second > 0) { if(iceTeaMap.get(TALL)*4 > iceTeaMap.get(VENTI)) { forth = second/4; second = second%4; } }else { if(iceTeaMap.get(SHORT)*8 > iceTeaMap.get(VENTI)) { forth = first/8; first = first%8; } } System.out.println(first * iceTeaMap.get(SHORT) + second * iceTeaMap.get(TALL) + third * iceTeaMap.get(GRANDE) + forth * iceTeaMap.get(VENTI)); } }
Submission Info
Submission Time | |
---|---|
Task | A - Ice Tea Store |
User | unirita107 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 1864 Byte |
Status | AC |
Exec Time | 73 ms |
Memory | 21076 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
All | sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 72 ms | 21076 KB |
sample_02.txt | AC | 71 ms | 20564 KB |
sample_03.txt | AC | 71 ms | 20436 KB |
sample_04.txt | AC | 72 ms | 20564 KB |
subtask_1_01.txt | AC | 69 ms | 20820 KB |
subtask_1_02.txt | AC | 72 ms | 20820 KB |
subtask_1_03.txt | AC | 69 ms | 17492 KB |
subtask_1_04.txt | AC | 72 ms | 20564 KB |
subtask_1_05.txt | AC | 71 ms | 19924 KB |
subtask_1_06.txt | AC | 73 ms | 20564 KB |
subtask_1_07.txt | AC | 71 ms | 20436 KB |
subtask_1_08.txt | AC | 71 ms | 20052 KB |
subtask_1_09.txt | AC | 71 ms | 20564 KB |
subtask_1_10.txt | AC | 69 ms | 18004 KB |
subtask_1_11.txt | AC | 71 ms | 21076 KB |
subtask_1_12.txt | AC | 70 ms | 19156 KB |
subtask_1_13.txt | AC | 70 ms | 19668 KB |
subtask_1_14.txt | AC | 71 ms | 17108 KB |
subtask_1_15.txt | AC | 70 ms | 17620 KB |