起点是右下角  终点是左上角
每次数据都是两行的点  输入n 表示有n列
接下来来的2行是 列与列之间的距离
最后一行是  行之间的距离
枚举就行
 
Sample test(s)
input
4
1 2 3
3 2 1
3 2 2 3
output
12
input
3
1 2
3 3
2 1 3
output
11
input
2
1
1
1 1
output
4
 # include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <string>
# include <cmath>
# include <queue>
# define LL long long
using namespace std ; const int INF = 0x3f3f3f3f ; int a[][] ;
int b[] ; int main()
{
int n;
while(scanf("%d",&n) != EOF)
{
int i , j ;
int sum = ;
for (i = ; i < ; i++)
for (j = ; j < n- ; j++)
scanf("%d" , &a[i][j]) ;
for (i = ; i < n ; i++)
scanf("%d" , &b[i]) ;
int ans[] = {INF , INF , INF} ;
for (i = ; i < n- ; i++)
{
sum += a[][i] ;
}
sum += b[] ;
ans[] = sum ;
sort(ans , ans+) ;
for (i = ; i < n- ; i++)
{
sum = sum - a[][i] + a[][i] ;
sum = sum - b[i] + b[i+] ;
ans[] = sum ;
sort(ans , ans+) ;
}
printf("%d\n" , ans[] + ans[]) ; }
return ;
}

最新文章

  1. CentOS 6.3下 安装 Mono 3.2 和Jexus 5.4
  2. LinkedList源码阅读笔记(基于JDK1.8)
  3. 第 20 章 CSS3 前缀和 rem
  4. [转]设置Android手机以使用ARM Streamline进行性能分析(二)
  5. 一个简单的3DTouch、Peek和Pop手势Demo,附github地址
  6. Web应用程序系统的多用户权限控制设计及实现-用户模块【7】
  7. [部署]CentOS yum源
  8. codevs 1133 表达式的值
  9. 鸟哥的linux私房菜学习记录之程序管理和SElinux初探
  10. Javascript 数组之判断取值和数组取值
  11. openstack(liberty):部署实验平台(二,简单版本软件安装 part2)
  12. TFS客户端登录用户修改
  13. js 基于函数伪造的方式实现继承
  14. 绝对URL和相对URL
  15. 数据结构(RMQ):UVAoj 11235 Frequent values
  16. selenium 学习笔记 ---新手学习记录(3) 问题总结(java)
  17. 【Machine Learning】Mahout基于协同过滤(CF)的用户推荐
  18. kvm学习小计
  19. java列表数据基本操作
  20. Linux Apache配置https访问

热门文章

  1. Dockerfile编写注意事项
  2. OpenLDAP介绍和安装
  3. linux之top命令详解
  4. Redis学习七:Redis的持久化-总结(Which one)
  5. 【学习DIV+CSS】1. 你必须知道的三个知识
  6. c++模板函数作为参数的疑惑
  7. 为FreeBSD安装adobe flash插件
  8. Java 对象初始化生命周期
  9. c# 生成随机N位数字串(每位都不重复)
  10. iphone清除数字链接