摘要:
Java版的 import java.util.*; class solution { private int T=0; private Scanner iner=new Scanner(System.in); private int v[]=new int[41]; private int c[]=new int[41]; private int s[]=new i... 阅读全文
摘要:
dp[i][j]=max{dp[i-1][j-v[i]]+c[i],dp[i-1][j]}; for(i=1;i<=n;i++){ for(j=v[i];j<=v;j++){//注意这里是从v[i]开始到V if(j>=v[i]) dp[j]=max{dp[j],dp[j-v[i]]+c[i]}; } } dp[j]=max{dp[j],dp[j-v[i]]+c[i]}; dp[i][j]=max 阅读全文
摘要:
class Solution{ private int a; private int b; private int sum=0; public Solution(int i,int j) { this.a=i; this.b=j; this.sum=this.a*this.b; } //最大公因数 pu... 阅读全文
摘要:
class Solution { private int w[]; private int dp[]; public int numSquares(int n) { w=new int[(int) (Math.sqrt(n)+1)]; dp=new int[n+1]; for(int i=1;i<=Math.sqr... 阅读全文