原题链接: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. ul中li元素横向排列且不换行

    ul { white-space: nowrap; } li { display: inline-block; }     white-space 属性设置如何处理元素内的空白. normal 默认. ...

  2. PoolManager

    我用的PoolManager版本是5.5.2的,导入的包总共有三个文件夹:Editor,Plugins,PoolManagerExampleFiles 1.Editor这个文件夹里面的东西,顾名思义, ...

  3. Python网络编程(子进程的创建与处理、简单群聊工具)

    前言: 昨天我们已经了解了多进程的原理以及它的实际使用 Unix/Linux操作系统提供了一个fork()系统调用,它非常特殊.普通的函数调用,调用一次,返回一次, 但是fork()调用一次,返回两次 ...

  4. 孤荷凌寒自学python第三十八天初识python的线程控制

     孤荷凌寒自学python第三十八天初识python的线程控制 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) 一.线程 在操作系统中存在着很多的可执行的应用程序,每个应用程序启动后,就可以看 ...

  5. 使用UltraEdit搭建自己的C/C++ IDE

    使用UltraEdit搭建自己的C/C++ IDE CodeBlocks的13.12版本啊,主要缺点是启动慢,而且在Windows上容易假死,写着写着就无响应了,然后死活活不过来.所以没办法,只好干脆 ...

  6. Makefile编写记录

    近期学习 Linux 需要使用 Makefile,网上搜罗了很多这方面的资料,所里在这里做一个整理. 1.静态模式 看一个例子: objects = foo.o bar.o all: $(object ...

  7. java与C#对比文章阅读

    文章:JAVA与C#的区别 讲了C#与java一些基本异同.    易语言官网有个表,比较了易语言.Java.C#的区别,比较全面可以借鉴.    

  8. POJ 2186 受欢迎的牛 Tarjan基础题

    #include<cstdio> #include<algorithm> #include<cstring> #include<vector> #inc ...

  9. 《c程序设计语言》读书笔记-4.2-扩充atof函数

    #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> ...

  10. Codeforces Round #462 (Div. 2)

    这是我打的第三场cf,个人的表现还是有点不成熟.暴露出了我的一些问题. 先打开A题,大概3min看懂题意+一小会儿的思考后开始码代码.一开始想着贪心地只取两个端点的值就好了,正准备交的时候回想起上次A ...