当前位置 : 主页 > 手机开发 > harmonyos >

cf 599 A (模拟)

来源:互联网 收集:自由互联 发布时间:2023-08-28
A. Patrick and Shopping time limit per test memory limit per test input output d 1meter long road between his house and the first shop and a d 2meter long road between his house and the second shop. Also, there is a road of length d 3 Patri


A. Patrick and Shopping



time limit per test



memory limit per test



input



output


d1 meter long road between his house and the first shop and a d2 meter long road between his house and the second shop. Also, there is a road of length d3



cf 599 A (模拟)_d3


Patrick always starts at his house. He should visit both shops moving only along the three existing roads and return back to his house. He doesn't mind visiting the same shop or passing the same road multiple times. The only goal is to minimize the total distance traveled.


Input



d1, d2, d3 (1 ≤ d1, d2, d3 ≤ 108) — the lengths of the paths.

  • d1
  • d2
  • d3


Output



Print the minimum distance that Patrick will have to walk in order to visit both shops and return to his house.


Sample test(s)



input



10 20 30



output



60



input



1 1 5



output



4


Note


The first sample is shown on the picture in the problem statement. One of the optimal routes is: house 

cf 599 A (模拟)_#include_02

 first shop 

cf 599 A (模拟)_#include_02

 second shop 

cf 599 A (模拟)_#include_02

house. In the second sample one of the optimal routes is: house 

cf 599 A (模拟)_#include_02

 first shop 

cf 599 A (模拟)_#include_02

 house 

cf 599 A (模拟)_#include_02

 second shop 

cf 599 A (模拟)_#include_02

 house.

#include <bits/stdc++.h>
using namespace std;
__int64 a[4];
int main()
{
    __int64 aa,b,c;
    scanf("%I64d%I64d%I64d",&aa,&b,&c);
    a[0]=2*(aa+b);
    a[1]=aa+b+c;
    a[2]=2*aa+2*c;
    a[3]=2*b+2*c;
    sort(a,a+4);
    printf("%I64d\n",a[0]);

    return 0;
}



上一篇:cf 602 B(模拟)
下一篇:没有了
网友评论