[Codeforces] [599A] Patrick and Shopping

Problem Statement

Loading...

Problem Analysis

Similar to [ZZULI][1799] wrz’s lucky money
all cases need to be covered completely

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include<stdio.h>
int main() {
    int a,b,c;
    while(scanf("%d %d %d",&a,&b,&c)!=EOF) {
        int x[5];
        x[0]=a+b+c;
        x[1]=a+a+b+b;
        x[2]=a+c+c+a;
        x[3]=b+c+c+b;
        int min=x[0];
        for(int i=1; i<4; i++)
            if(min>x[i])
                min=x[i];
        printf("%d\n",min);
    }
}

Loading...