原题链接: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. nodejs下载图片到本地,根据百度图片查找相应的图片,通过nodejs保存到本地文件夹

    根据百度图片查找相应的图片:输入图片关键字,输入图片数量(默认是30条),通过nodejs将批量保存图片到本地文件夹. 代码已上传到github上:代码github的地址 下载后进去back-end: ...

  2. Entity Framework(四)--EF原理和状态管理

    一.原理: 如何查看真正执行的SQL是怎样的? DbContext有一个Database属性,Database属性有一个Log属性,是Action委托类型其中的参数就是sql语句,每次EF执行sql语 ...

  3. 1020 Tree Traversals (25 分)(二叉树的遍历)

    给出一个棵二叉树的后序遍历和中序遍历,求二叉树的层序遍历 #include<bits/stdc++.h> using namespace std; ; int in[N]; int pos ...

  4. php天龙八部

    <?php /* 一.操作步骤: 连接MySQL数据库 判断是否连接成功 选择数据库 设置字符集 准备SQL语句 向MySQL服务发送SQL语句 解析处理结果集 释放结果集,关闭数据库连接 */ ...

  5. 第二阶段团队冲刺-two

    昨天: 处理第一次启动服务器500的问题. 今天: 修复博客作业查询功能. 遇到的问题: 无.

  6. 手机App测试如何获取包名的入口【两种方式】

    在进行手机APP测试的时候经常要获取包名.那么何为包名呢?简单来说其实就是手机APP的安装apk文件的名称,每个手机APP(软件)的包名都是唯一的. 那么我们怎样来获取包名以及包名的入口呢? 方法一: ...

  7. crond守护进程

    Linux系统任务计划/etc/crontab cron的主配置文件,可以定义PATHcron格式如下:# .----------------分钟 (0 - 59)# | .------------- ...

  8. macOS Mojave 深色模式

    macOS Mojave 深色模式 mac 关闭 深色模式 https://support.apple.com/zh-cn/HT208976 https://www.apple.com/cn/maco ...

  9. mogodb gui

    mogodb gui https://robomongo.org/ https://github.com/Studio3T/robomongo https://www.imooc.com/learn/ ...

  10. JZOJ 5280 膜法师

    好啰嗦......还好作者给了一句话题意,不然光看题就很耗费时间. 样例输入: 1 6 3 1 78 69 55 102 233 666 样例输出: 1 2 3 4 5 6 11  数据范围: 思路: ...