原题链接: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 模拟的更多相关文章

  1. Codeforces Round #325 (Div. 2) Alena's Schedule 模拟

    原题链接:http://codeforces.com/contest/586/problem/A 题意: 大概就是给你个序列..瞎比让你统计统计什么长度 题解: 就瞎比搞搞就好 代码: #includ ...

  2. Codeforces Round #368 (Div. 2) B. Bakery (模拟)

    Bakery 题目链接: http://codeforces.com/contest/707/problem/B Description Masha wants to open her own bak ...

  3. 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 ...

  4. Codeforces Round #325 (Div. 2) B. Laurenty and Shop 前缀+后缀

                                                                                 B. Laurenty and Shop   ...

  5. Codeforces Round #325 (Div. 2) B. Laurenty and Shop 有规律的图 暴力枚举

    B. Laurenty and Shoptime limit per test1 secondmemory limit per test256 megabytesinputstandard input ...

  6. Codeforces Round #325 (Div. 2) B

    B. Laurenty and Shop time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. Codeforces Round #325 (Div. 2)

    水 A - Alena's Schedule /************************************************ * Author :Running_Time * Cr ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. 【Python】python内置函数、列表生成式、生成器

    一.内置函数 1 print(all([1,2,3,4]))#判断可迭代的对象里面的值是否都为真 2 print(any([0,1,2,3,4]))#判断可迭代的对象里面的值是否有一个为真 3 pri ...

  2. 孤荷凌寒自学python第十五天python循环控制语句

    孤荷凌寒自学python第十五天python循环控制语句 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) python中只有两种循环控制语句 一.while循环 while 条件判断式 1: ...

  3. 深入MySQL用户自定义变量:使用详解及其使用场景案例

    一.前言 在前段工作中,曾几次收到超级话题积分漏记的用户反馈.通过源码的阅读分析后,发现问题出在高并发分布式场景下的计数器上.计数器的值会影响用户当前行为所获得积分的大小.比如,当用户在某超级话题下连 ...

  4. winform 路径

    System.AppDomain.CurrentDomain.BaseDirectory d:\project\bin\release\

  5. PHP路径相关 dirname,realpath,__FILE__

    ​比如:程序根目录在:E:\wamp\www 中 1.    __FILE__   当前文件的绝对路径 如果在index.php中调用 则返回  E:\wamp\www\index.php 下面再看一 ...

  6. Android中如何为自定义控件增加状态?

    在android开发中我们常常需要对控件进行相关操作,虽然网上已有很多对控件酷炫的操作,但小编今天给大家分享的纯属实用出发.在查看了一些列安卓教程和文档后,发现了一位大牛分享的非常不错的有关andro ...

  7. 一文看懂Kafka消息格式的演变

    摘要 对于一个成熟的消息中间件而言,消息格式不仅关系到功能维度的扩展,还牵涉到性能维度的优化.随着Kafka的迅猛发展,其消息格式也在不断的升级改进,从0.8.x版本开始到现在的1.1.x版本,Kaf ...

  8. ES6特性以及代码demo

    块级作用域let if(true){ let fruit = ‘apple’; } consoloe.log(fruit);//会报错,因为let只在if{ }的作用域有效,也就是块级作用域 恒量co ...

  9. mysql 查询结果创建表

    用 SELECT 的结果创建表 关系数据库的一个重要概念是,任何数据都表示为行和列组成的表,而每条 SELECT 语句的结果也都是一个行和列组成的表.在许多情况下,来自 SELECT 的“表”仅是一个 ...

  10. 插件安装:包管理器——Package Control

    首先,按CTRL+`,打开控制台   粘贴下面的代码,之后回车 如果是sublime3 ? 1 import urllib.request,os,hashlib; h = '7183a2d3e96f1 ...