Submission #1540261


Source Code Expand

#include<stdio.h>
#include<stdlib.h>

int compare_ll(const void *a, const void *b) {
  return *(long long*)a - *(long long*)b;
}

int main() {
  long long q, h, s, d, n;
  int flag = 0;
  scanf("%lld %lld %lld %lld", &q, &h, &s, &d);
  scanf("%lld", &n);
  long long pertwo[4];
  pertwo[0] = q*8;
  pertwo[1] = h*4;
  pertwo[2] = s*2;
  pertwo[3] = d;
  qsort(pertwo, 4, sizeof(long long), compare_ll);
  if (pertwo[0] == d) {
    if (pertwo[1] == d) {
      flag = 1;
    } else {
      flag = 2;
    }
  } else {
    flag = 1;
  }
  if (flag == 1) {
    long long ans = n*pertwo[0] / 2;
    printf("%lld", ans);
  }
  if (flag == 2) {
    if (n % 2 == 0) {
      long long ans = n*pertwo[0] / 2;
      printf("%lld", ans);
    } else {
      long long ans = (n-1)*pertwo[0] / 2 + pertwo[1]/2;
      printf("%lld", ans);
    }
  }
  return 0;
}

Submission Info

Submission Time
Task A - Ice Tea Store
User sauce
Language C (GCC 5.4.1)
Score 300
Code Size 888 Byte
Status AC
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:11:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld %lld %lld", &q, &h, &s, &d);
   ^
./Main.c:12:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &n);
   ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 23
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 0 ms 128 KB
sample_02.txt AC 0 ms 128 KB
sample_03.txt AC 1 ms 128 KB
sample_04.txt AC 0 ms 128 KB
subtask_1_01.txt AC 1 ms 128 KB
subtask_1_02.txt AC 0 ms 128 KB
subtask_1_03.txt AC 1 ms 128 KB
subtask_1_04.txt AC 0 ms 128 KB
subtask_1_05.txt AC 0 ms 128 KB
subtask_1_06.txt AC 0 ms 128 KB
subtask_1_07.txt AC 0 ms 128 KB
subtask_1_08.txt AC 1 ms 128 KB
subtask_1_09.txt AC 1 ms 128 KB
subtask_1_10.txt AC 1 ms 128 KB
subtask_1_11.txt AC 0 ms 128 KB
subtask_1_12.txt AC 1 ms 128 KB
subtask_1_13.txt AC 0 ms 128 KB
subtask_1_14.txt AC 0 ms 128 KB
subtask_1_15.txt AC 0 ms 128 KB