摘要: import java.util.Scanner; class test { private double dp[];//用来存储每段的最短时间 private double p[];//用来存储每个充电站点离起点的距离 private int n,c,t; private double vr,vt1,vt2; private double Length; public boolean Solut 阅读全文
posted @ 2019-10-05 13:49 pycodego 阅读(246) 评论(0) 推荐(0) 编辑
摘要: package dp; class dpArray{ private int dp[][]; private int w[]; private int v[]; private int memo[]; public int res(){ for(int i=1;i<=4;++i){ for(int j=1;j<=7;++j){ if(j<w[i]){ dp[i][j]=dp[i-1][j]; /* 阅读全文
posted @ 2019-10-05 12:20 pycodego 阅读(262) 评论(0) 推荐(0) 编辑
摘要: class Solutionx{ private int memo[][]; private int w[]; private int v[]; public int bestValue(int Index,int c){ if(Index =w[Index]){ res=Math.max(res, bestValu... 阅读全文
posted @ 2019-10-05 01:09 pycodego 阅读(192) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int w[5] = { 0, 2, 3, 4, 5 }; //商品的体积2、3、4、5 int v[5] = { 0, 3, 4, 5, 6 }; //商品的价值3、4、5、6 int bagV = 8; //背包大... 阅读全文
posted @ 2019-10-05 00:08 pycodego 阅读(146) 评论(0) 推荐(0) 编辑
摘要: /** *一定要明确dp数组的含义 * * * * */ class Solution{ private: int arr[10][10]; int dp[10][10]; //dp数组的含义为对应位置到底部的最大和 int Length; public: Solution(int Length){ srand(time(NULL)); this->Length = Leng... 阅读全文
posted @ 2019-10-04 23:07 pycodego 阅读(122) 评论(0) 推荐(0) 编辑
摘要: package com.Long class Solution { private int Max=0; public int maxProfit(int[] prices) { for(int i=1;i0) { Max+=prices[i]-prices[i-1]; } } return ... 阅读全文
posted @ 2019-10-04 16:13 pycodego 阅读(207) 评论(0) 推荐(0) 编辑
摘要: package com.Long; import java.util.PriorityQueue; import java.util.Queue; import java.util.Random; class node implements Comparable{ int val; int Index; @Override public int compareTo(node arg... 阅读全文
posted @ 2019-10-04 16:05 pycodego 阅读(262) 评论(0) 推荐(0) 编辑
摘要: package com.file; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Arrays; class Solution 阅读全文
posted @ 2019-10-04 12:39 pycodego 阅读(388) 评论(0) 推荐(0) 编辑
摘要: class node{ int x; int y; } public class Test { public static void main(String[] args) { MyQueue q=new MyQueue(); q.push("xxx"); q.push("xxx"); q... 阅读全文
posted @ 2019-10-03 22:48 pycodego 阅读(599) 评论(0) 推荐(0) 编辑
摘要: import java.util.Deque; import java.util.LinkedList; class node{ int x; int y; } class Solution{ private int dir[][]=new int[][] {{0,-1},{-1,0},{0,1},{1,0}}; private node parentx[][]; private int Coun 阅读全文
posted @ 2019-10-03 22:20 pycodego 阅读(337) 评论(0) 推荐(0) 编辑