Editorial for Фигури


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.
by: maya

Тестовете можете да видите тук.

Примерно решение на C++:

#include <iostream>
using namespace std;
int main()
{
    int a,b,c,d,h,max1,max2,per=0,max1_2;
    cin>>a>>b>>c>>d>>h;
    max1=a;
    if(max1<=b) max1=b;
    if(max1<=c) max1=c;
    max2=d;
    if(max2<=h) 
      max2=h;
    if(max1<=max2) 
    {
      per=((a+b+c+d*2+h*2)-(max1+max2))+(max2-max1);
    }
    if(max1>=max2)
       per=((a+b+c+d*2+h*2)-(max2+max1))+(max1-max2);
    cout<<per<<endl;
    return 0;
}

Comments

There are no comments at the moment.