Codeforces Round #325 (Div. 2) Laurenty and Shop 模拟
原题链接:http://codeforces.com/contest/586/problem/B
题意:
大概就是给你一个两行的路,让你寻找一个来回的最短路,并且不能走重复的路。
题解:
就枚举上下选的是哪条路来跨过主干道就好
代码:
#include<iostream>
#include<cstring>
#include<vector>
#define MAX_N 55
using namespace std; int n;
int a[][MAX_N];
int sum[][MAX_N];
int b[MAX_N]; int main(){
cin>>n;
for(int i=;i<;i++)
for(int j=;j<=n-;j++){
cin>>a[i][j];
sum[i][j]=a[i][j]+sum[i][j-];
}
for(int i=;i<=n;i++)cin>>b[i];
int ans=;
for(int i=;i<=n;i++)
for(int j=;j<=n;j++){
if(i==j)continue;
ans=min(ans,b[i]+b[j]+sum[][i-]+sum[][n-]-sum[][i-]+sum[][j-]+sum[][n-]-sum[][j-]);
}
cout<<ans<<endl;
return ;
}
Codeforces Round #325 (Div. 2) Laurenty and Shop 模拟的更多相关文章
- Codeforces Round #325 (Div. 2) Alena's Schedule 模拟
原题链接:http://codeforces.com/contest/586/problem/A 题意: 大概就是给你个序列..瞎比让你统计统计什么长度 题解: 就瞎比搞搞就好 代码: #includ ...
- Codeforces Round #368 (Div. 2) B. Bakery (模拟)
Bakery 题目链接: http://codeforces.com/contest/707/problem/B Description Masha wants to open her own bak ...
- Codeforces Round #325 (Div. 2) B. Laurenty and Shop 前缀和
B. Laurenty and Shop Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/p ...
- Codeforces Round #325 (Div. 2) B. Laurenty and Shop 前缀+后缀
B. Laurenty and Shop ...
- Codeforces Round #325 (Div. 2) B. Laurenty and Shop 有规律的图 暴力枚举
B. Laurenty and Shoptime limit per test1 secondmemory limit per test256 megabytesinputstandard input ...
- Codeforces Round #325 (Div. 2) B
B. Laurenty and Shop time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #325 (Div. 2)
水 A - Alena's Schedule /************************************************ * Author :Running_Time * Cr ...
- Codeforces Round #284 (Div. 2)A B C 模拟 数学
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Round #285 (Div. 2) A B C 模拟 stl 拓扑排序
A. Contest time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
随机推荐
- 每天一个Linux命令(1):cd命令
cd命令用来切换工作目录至dirName,其中dirName表示绝对路径或相对路径.若目录名称省略,则切换至使用者的home directory(也就是钢login时所在的目录).另外,~ 也表示ho ...
- jvm可视化工具jvisualvm插件——Visual GC
转自:http://blog.csdn.net/xuelinmei_happy/article/details/51090115 Visual GC是一个Java 内存使用分析与GC收集的可视化工具插 ...
- BeanShell中Sring变量引用
问题现象:BeanShell中,一个String类型的字符串存在多个变量,通过${}引用变量后,发送到服务器的还是${} 解决方法:String类型数据中存在多个变量时,使用"+变量+&qu ...
- Monkey、Monkeyrunner之间的区别
Monkey.Monkeyrunner之间的区别 一.Monkey Monkey是Android中的一个命令行工具,可以运行在模拟器里或实际设备中.它向系统发送伪随机的用户事件流(如按键输入.触摸屏输 ...
- 解决Navicat for MySQL 连接 Mysql 8.0.11 出现1251- Client does not support authentication protocol 错误
安装MySQL8.0之后,使用Navicat连接数据库,报1251错误. 上网搜索解决方案,网上说出现这种情况的原因是:mysql8 之前的版本中加密规则是mysql_native_password, ...
- 牛客网暑期ACM多校训练营(第一场):D-Two Graphs
链接:D-Two Graphs 题意:给出图G1和G2,求G2的子图中和G1同构的个数. 题解:只有8个点,暴力枚举G2的点每个排列,让G1映射到G2中,求出同构个数a.同构的G2就是在G1有边的对应 ...
- docker 踩坑笔记之 psql: could not connect to server
最近在用docker跑rails,也遇到了一些坑,这里记录一下. 首先build项目: docker-compose build 然后就开始报错了: psql: could not connect t ...
- Android之测试相关知识点
程序员在开发的过程中一定要进行严格的测试: --->相关概念 * 根据是否知道源代码可以分为: 黑盒测试:只关心程序执行的过程和结果并不知道程序源代码. 白盒测试: 根据源代码写测试方法 或者 ...
- 替换Fragment 报错 The specified child already has a parent. You must call removeView() on the child's parent first.
在将一个fragment替换到一个frameLayout的时候报错: code: transaction.replace(R.id.fragment_container, fragment2); 错误 ...
- UVALive 4764 简单dp水题(也可以暴力求解)
B - Bing it Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status ...