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 ...
随机推荐
- UIAutomator2、Appium、Robotium搭建环境与框架对比
UIAutomator2.Appium.Robotium搭建环境与框架对比 一.框架介绍 Appium 特点 appium 是一个自动化测试开源工具,支持 iOS 平台和 Android 平台上的原生 ...
- Python学习2,小程序
今天主要就是弄懂了一个循环判 for i in [1,2]: for j in [1, 2, 3]: print(i, j) break else: print("for-j") ...
- PHP页面跳转总结
一.使用php内置函数:header()函数 <?php$url='./test.php'; header("Location:$url"); ?> 注意Locatio ...
- 第二阶段团队冲刺-six
昨天: 完成打印名单的功能. 今天: 合并程序(添加打印txt). 遇到的问题: web.xml中配置url-pattern一直不合适,不知道为什么会影响界面.
- 初识MVC框架
MVC框架 是一个框架模式,它使应用程序的输入.处理和输出分开.它可以使业务逻辑.数据.界面显示分离,使得耦合度大大降低,在这一方面与"三层"思想类似. M--Model ...
- POJ 3041 Asteroids | 匈牙利算法模板
emmmmm 让你敲个匈牙利 #include<cstdio> #include<algorithm> #include<cstring> #define N 51 ...
- 【BZOJ 2809 dispatching】
Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 4393 Solved: 2246[Submit][Status][Discuss] Descript ...
- mongo-aggregate命令详解
一.aggregate执行流程和特性 1.执行流程: db.collection.aggregate()是基于数据处理的聚合管道,每个文档通过一个由多个阶段(stage)组成的管道,可以对每个阶段的管 ...
- topcoder(BinaryCode)
Problem Statement Let's say you have a binary string such as the following: 011100011 One way t ...
- 启动、停止、删除Windows服务
启动: @echo.服务启动...... @echo off @sc create Service_SMS binPath= "D:\公司制度等文件\项目\河北劳动力市场检测系统\Windo ...