#include <stdio.h>

int main(){
    int a,b,c,d,i,m=0,n=0,x[7]={0},s=0;
    int p=0,q=0,k=0;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    x[a]++; x[b]++; x[c]++; x[d]++;
    for(i=0;i<=6;i++){0
        if(x[i]>m){ m=x[i]; n=i; }
    }
    if(m==4){
        s=50000+n*5000;
    }else if(m==3){
        s=10000+n*1000;
    }else if(m==2){
        for(i=1;i<=6;i++){
            if(x[i]==2){
                if(p==0) p=i;
                else q=i;
            }
        }
        if(q!=0) s=2000+p*500+q*500;
        else s=1000+n*100;
    }else{
        for(i=6;i>=1;i--){
            if(x[i]){ k=i; break; }
        }
        s=k*100;
    }
    printf("%d\n",s);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: