Submission #5817239


Source Code Expand

Copy
#include<iostream>
#include<vector>
#include<algorithm>

typedef long long ll;

using namespace std;

int main(){
  ll Q,H,S,D; cin >> Q >> H >> S >> D;
   long double N; cin >> N;
  
  ll sum = 0; 
  
  ll X = min(min(D,2*S),min(4*H,8*Q)); //2リットル以上
  ll Y = min(S,min(2*H,4*Q)); //1リットル以上2リットル未満
  ll Z = min(H,2*Q); //0.5リットル以上1リットル未満
  
  while( N >= 2.0){
     N -= 2.0; sum += X;}
  while( 1.0 <= N && N < 2.0){
    N -= 1; sum += Y;}
  while( 0.5 <= N && N < 1.0){
    N -= 0.5; sum += Z;}
  while( 0.0 < N && N < 0.5){
    N -= 0.25; sum += Q;}
  
  cout << sum << endl; return 0;}
    

Submission Info

Submission Time
Task A - Ice Tea Store
User youyin
Language C++14 (GCC 5.4.1)
Score 300
Code Size 686 Byte
Status
Exec Time 649 ms
Memory 384 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All 300 / 300 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 2 ms 384 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB
sample_04.txt 81 ms 256 KB
subtask_1_01.txt 1 ms 256 KB
subtask_1_02.txt 649 ms 256 KB
subtask_1_03.txt 649 ms 256 KB
subtask_1_04.txt 83 ms 256 KB
subtask_1_05.txt 360 ms 256 KB
subtask_1_06.txt 182 ms 256 KB
subtask_1_07.txt 12 ms 256 KB
subtask_1_08.txt 384 ms 256 KB
subtask_1_09.txt 480 ms 256 KB
subtask_1_10.txt 143 ms 256 KB
subtask_1_11.txt 560 ms 256 KB
subtask_1_12.txt 649 ms 256 KB
subtask_1_13.txt 613 ms 256 KB
subtask_1_14.txt 640 ms 256 KB
subtask_1_15.txt 377 ms 256 KB