Codeforces Round #332 (Div. 2) A. Patrick and Shopping

原创 2015年11月21日 11:11:04

题意:给你三个距离,a,b,c,求经过两家shop的最短路。

解:求min(a+b+c,min(2*b+2*a,min(2*a+2*c,2*b+2*c)));

#include<stdio.h>
#include<algorithm>
using namespace std;
#define LL long long
int main()
{
    LL a,b,c;
    while(scanf("%lld%lld%lld",&a,&b,&c)!=EOF)
    {
        LL x1=2*a+2*b;
        LL x2=2*a+2*c;
        LL x3=2*b+2*c;
        LL x4=a+b+c;
        LL y=min(x1,min(x2,min(x3,x4)));
        printf("%lld\n",y);
    }
    return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

Codeforces Round #332 (Div. 2) A. Patrick and Shopping

A. Patrick and Shopping time limit per test 1 second memory limit per test 256 megabytes...

【Codeforces Round 332 (Div 2)A】【水题】A. Patrick and Shopping 遍历三元环的最小成本

A. Patrick and Shopping time limit per test 1 second memory limit per test 256 megabytes...

【Codeforces Round 332 (Div 2)D】【数学 公式推导】Spongebob and Squares 正方形数量恰好为x个的所有大矩形

D. Spongebob and Squares time limit per test 2 seconds memory limit per test 256 megabyt...

Codeforces Round #332 (Div. 2)_B. Spongebob and Joke

B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes ...

Codeforces Round #332 (Div. 2) D. Spongebob and Squares

Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked y...

【Codeforces Round 332 (Div 2)B】【扭转题意 位置映射】Spongebob and Joke 给b[]中的每个数找f[]中的位置

B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes ...

Codeforces Round #332 (Div. 2) D. Spongebob and Squares详解

Codeforces Round #332 (Div. 2) D. Spongebob and Squares

Codeforces Round #332 (Div. 2) B. Spongebob and Joke

Codeforces Round #332 (Div. 2) C. Spongebob and Joke Vector

Codeforces Round #332 (Div. 2)C. Day at the Beach

C. Day at the Beach time limit per test 2 seconds memory limit per test 256 megabytes ...

Codeforces Round #332 (Div. 2) C. Day at the Beach

C. Day at the Beach time limit per test 2 seconds memory limit per test 256 megabytes ...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Codeforces Round #332 (Div. 2) A. Patrick and Shopping
举报原因:
原因补充:

(最多只允许输入30个字)