cppOlimp/zolotoy_pesok.cpp

31 lines
658 B
C++
Raw Normal View History

2022-02-07 22:33:05 +03:00
//acmp.ru 0685 zolotoy_pesok.cpp 10%
#include <stdio.h>
int main(){
freopen("INPUT.TXT", "r", stdin);
freopen("OUTPUT.TXT", "w", stdout);
int arr1[3], arr2[3];
scanf("%i %i %i %i %i %i", &arr1[0], &arr1[1], &arr1[2], &arr2[0], &arr2[1], &arr2[2]);
int maxprice = 0, maxkg = 0, pri, kgi, currentprice = 0;
for (int j = 0; j < 3; j++){
for (int i = 0; i < 3; i++){
if(arr1[i] > maxprice){
maxprice = arr1[i];
pri = i;
}
if(arr2[i] > maxkg){
maxkg = arr2[i];
kgi = i;
}
}
arr1[pri] = 0;
arr2[kgi] = 0;
currentprice = currentprice+(maxkg * maxprice);
maxkg = 0;
maxprice = 0;
}
printf("%i",currentprice);
}