poj 1260 Java实现
来源:互联网 发布:windows怎么截图窗口 编辑:程序博客网 时间:2024/06/08 08:51
poj 1260 Java实现
import java.util.Scanner;public class Main1260 {static int Min(int a, int b) {return a > b ? b : a;}public static void main(String[] args) throws Exception {System.setIn(new java.io.FileInputStream("1260.txt"));Scanner sc = new Scanner(System.in);int T = sc.nextInt();for (int i = 0; i < T; i++) {int C = sc.nextInt();int Nu[] = new int[C+1];int[] Pi = new int[C+1];int dp[] = new int[C + 1];int sum[]=new int[C+1];for (int j = 1; j <= C; j++) {Nu[j]=sc.nextInt();sum[j]=sum[j-1]+Nu[j];Pi[j]=sc.nextInt();}dp[0] = 0;for (int j = 1; j <= C; j++) {dp[j] = (Nu[j] + 10) * Pi[j] + dp[j - 1];for (int j2 = 0; j2 < j; j2++) {dp[j]=Min(dp[j], (sum[j]-sum[j2]+10)*Pi[j]+dp[j2]);}}System.out.println(dp[C]);}}}
阅读全文
0 0
- poj 1260 Java实现
- poj 3431 Java实现
- POJ 1185 java实现
- POJ 3267 java实现
- POJ 3735 java实现
- 北大POJ 1001 (Java实现)
- POJ 2636 Electrical Outlets java实现
- Java实现POJ 1017:装箱问题
- poj 3070 java实现矩阵快速幂
- POJ 1001 Exponentiation(大数幂Java实现)
- 【java实现大实数幂次方】POJ 1001
- poj 1007实现感想
- poj 1001代码实现
- POJ 2418 Java
- POJ 2299 Java
- POJ 1011 - Java
- poj 1032 java版本
- poj 2389 Java
- boost :: scoped_ptr的和std ::的unique_ptr的区别 是之间的唯一不同boost::scoped_ptr<T>和std::unique_ptr<T>的事实std::uni
- WEB前端性能优化
- 完全卸载GitLab
- jQuery Mobile学习笔记(六)——jQuery Mobile API
- .NET及.NET Core系统架构
- poj 1260 Java实现
- Java applet can't open files under Safari 7
- Spring @Validate 报 :"No validator could be found for type: java.lang.Long" 异常
- 读书笔记∣元数据:用数据的数据管理你的世界 Ch.3-4
- java web出现405已经导入jar包的正确方式
- mysql用命令修改数据库的用户名和密码
- Glide设置圆角图片后设置ImageVIew的scanType="centerCrop"无效解决办法
- Bus Hound 的使用方法
- 用栈实现快速排序