摘要: import java.util.*; public class Main{ public static void main(String[] args) { Scanner is=new Scanner(System.in); while(is.hasNextInt()) { int n=is.nextInt(); ... 阅读全文
posted @ 2018-03-21 22:01 即便那总是过去 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 1.类似如下的题目 X星球要派出一个5人组成的观察团前往W星。 其中:A国最多可以派出4人。B国最多可以派出2人。C国最多可以派出2人。D国最多可以派出1人。E国最多可以派出1人。F国最多可以派出3人。那么最终派往W星的观察团会有多少种国别的不同组合呢? 2.通用解法代码 阅读全文
posted @ 2018-03-21 18:13 即便那总是过去 阅读(166) 评论(0) 推荐(0) 编辑
摘要: package test; import java.util.*; public class Main{ public static int f(int n,int k, int goal){ if(goal==1) return n-k+1; if(n-k+1=1;i--) { for(int j=2;j<=m;j++) { if(n-i+1<... 阅读全文
posted @ 2018-03-21 16:54 即便那总是过去 阅读(346) 评论(0) 推荐(0) 编辑
摘要: public List> permute(int[] nums) { List> res = new ArrayList(); f1(0, nums, res); return res; } private void f1(int i, final int[] nums, List> res) { if (... 阅读全文
posted @ 2018-03-21 15:34 即便那总是过去 阅读(1874) 评论(0) 推荐(0) 编辑