Submission #480144


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

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

int main(int argc, const char * argv[]) {
    int sum[10], c = 0;
    int x[5];
    scanf("%d %d %d %d %d", x, x + 1, x + 2, x + 3, x + 4);
    for (int i = 0; i < 5; i++) {
        for (int j = i + 1; j < 5; j++) {
            for (int k = j + 1; k < 5; k++) {
                sum[c++] = x[i] + x[j] + x[k];
            }
        }
    }
    qsort(sum, 10, sizeof(int), compare);
    printf("%d\n", sum[2]);
    return 0;
}

Submission Info

Submission Time
Task C - 数を3つ選ぶマン
User tkhp
Language C++ (GCC 4.9.2)
Score 100
Code Size 629 Byte
Status AC
Exec Time 24 ms
Memory 800 KiB

Compile Error

./Main.cpp: In function ‘int main(int, const char**)’:
./Main.cpp:15:59: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d %d", x, x + 1, x + 2, x + 3, x + 4);
                                                           ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 15
Set Name Test Cases
Sample example_0.txt, example_1.txt
All example_0.txt, example_1.txt, handmade_0.txt, handmade_1.txt, handmade_2.txt, handmade_3.txt, handmade_4.txt, handmade_5.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, example_0.txt, example_1.txt
Case Name Status Exec Time Memory
example_0.txt AC 24 ms 796 KiB
example_1.txt AC 24 ms 736 KiB
handmade_0.txt AC 24 ms 704 KiB
handmade_1.txt AC 22 ms 704 KiB
handmade_2.txt AC 23 ms 668 KiB
handmade_3.txt AC 23 ms 704 KiB
handmade_4.txt AC 23 ms 796 KiB
handmade_5.txt AC 22 ms 800 KiB
random_0.txt AC 24 ms 800 KiB
random_1.txt AC 24 ms 652 KiB
random_2.txt AC 23 ms 800 KiB
random_3.txt AC 24 ms 800 KiB
random_4.txt AC 23 ms 708 KiB