Codeforces Round #332 (Div. 2)A. Patrick and Shopping(简单题)
来源:互联网 发布:seo自学好学吗 编辑:程序博客网 时间:2024/05/18 02:37
题目链接
题意:给出家到A,B超市的距离,以及超市之间的距离,问去了A,B超市,再回家的最小路径。
解法:枚举四种情况,手残用了inf(初始化不够大= =)
#include<bits/stdc++.h>using namespace std;#define LL long long#define pb push_back#define X first#define Y second#define cl(a,b) memset(a,b,sizeof(a))typedef pair<int,int> P;const int maxn=300005;const LL inf=1<<27;const LL mod=1e9+7;int main(){ LL a,b,c; cin>>a>>b>>c; LL ans=a+b+c; ans=min(ans,2*(a+b)); ans=min(ans,a+a+c+c); ans=min(ans,b+b+c+c); cout<<ans<<endl; return 0;}
0 0
- Codeforces Round #332 (Div. 2)A. Patrick and Shopping(简单题)
- Codeforces Round #332 (Div. 2) A. Patrick and Shopping
- Codeforces Round #332 (Div. 2) A. Patrick and Shopping
- Codeforces Round #332 (Div. 2) A. Patrick and Shopping
- Codeforces Round #332 (Div. 2) 599A Patrick and Shopping(模拟)
- 【Codeforces Round 332 (Div 2)A】【水题】A. Patrick and Shopping 遍历三元环的最小成本
- Patrick and Shopping Codeforces Round #332
- 【CodeForces】599A - Patrick and Shopping(枚举)
- 【Codeforces】-599A-Patrick and Shopping(水)
- Codeforces 599A Patrick and Shopping 【水题】
- Codeforces 599 A. Patrick and Shopping
- CodeForces 599A Patrick and Shopping
- CodeForces 599A Patrick and Shopping
- 【CodeForces】[599A]Patrick and Shopping
- CodeForces 599A Patrick and Shopping
- 【Codeforces 599A 】Patrick and Shopping
- 【codeforces】Patrick and Shopping
- A. Patrick and Shopping
- c++ 对象模型(二)
- iOS 开发导航栏使用系统自定义属性基本4条
- linux 下 FTP 配置文件详解
- WebView相关
- ABB 机器人 压包指令PackRawBytes 解包指令UnpackRawBytes
- Codeforces Round #332 (Div. 2)A. Patrick and Shopping(简单题)
- Android 开发如何做好内存优化
- php发邮件
- 聊天室软件设计-nodejs
- hdoj DeBruijin 2894 (dfs&&欧拉回路转化) 好题
- ios审核加急服务
- 十二进制加计数器-20151112
- 《第一行代码--Android》读书笔记之内容提供器
- 单片机 MSP430 模拟IIC编程(2)