`
lylegend13
  • 浏览: 82778 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论
文章列表

传递对象

1 public class test { public static void main(String[] args) { A a = new A(); System.out.println(a.v);// 0 setValue(a); System.out.println(a.v);// 1 setA(a); System.out.println(a.v);// 1 } public static void setValue(A a) { a.v = 1; } public static void se ...

希尔排序

    博客分类:
  • Java
public class test { public static void main(String[] args) { int N = 10; int[] a = new int[N]; for (int i = 0; i < N; i++) { a[i] = (int) (Math.random() * 100); System.out.print(a[i] + "\t"); } System.out.println(); sort(a, N - 1); for (int i = 0 ...

堆排序

    博客分类:
  • Java
public class test { public static void main(String[] args) { int N = 10; int[] a = new int[N]; for (int i = 0; i < N; i++) { a[i] = (int) (Math.random() * 100); System.out.print(a[i] + "\t"); } System.out.println(); sort(a, N - 1); for (int i = 0 ...

归并排序

    博客分类:
  • Java
public class test { public static void main(String[] args) { int N = 10; int[] a = new int[N]; for (int i = 0; i < N; i++) { a[i] = (int) (Math.random() * 100); System.out.print(a[i] + "\t"); } System.out.println(); sort(a, 0, N - 1); for (int i ...
题目地址:http://news.bangkaow.com/news/20110812/227061.html   题目简述:求大于某个整数n的相邻两位数不同的最小的整数。   public class test { public static void main(String[] args) { // int num = (int) (Math.random() * 10000000); int num = 9899; System.out.println(num); System.out.println(getResult(num)); } ...

快速排序

    博客分类:
  • Java
public class test { public static void main(String[] args) { int N = 10; int[] a = new int[N]; for (int i = 0; i < N; i++) { a[i] = (int) (Math.random() * 100); System.out.print(a[i] + "\t"); } System.out.println(); sort(a, 0, N - 1); for (int i ...
  通过getPhysicalNumberOfRows()获得的实际行数,不一定有数据的行数。   比如某个单元格只设置了非“常规”的格式,它也会被POI认为是实际行。     不过POI里似乎没有没有这样的方法,getNextPhysicalRow()。   所以只好从getFirstRowNum()到getLastRowNum()遍历,如果null==currentRow,验证下一行。   try { Workbook hwb = new HSSFWorkbook( new FileInputStream("C:\\1.xls")); Shee ...

1006

    博客分类:
  • Java
仿别人的过的   import java.util.Scanner; public class Main { public static void main(String[] args) { int[] a = new int[4]; Scanner s = new Scanner(System.in); int no = 1; while (true) { boolean end = true; for (int i = 0; i < 4; i++) { a[i] = s.nextInt(); if (a ...

1013

    博客分类:
  • Java
  为了测试数据,在网上看了好多思想,还是坚持自己最初的想法,字符转成数组。     import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); while (s.hasNext()) { for (int i = s.nextInt(); i >= 1; i--) { int[] a = new int[12];// 把字符对应成int数组 int ...

1005

    博客分类:
  • Java
原理: PI*r*r/2 <= 50*年数   import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); while (true) { int row = s.nextInt(); for (int i = 1; i <= row; i++) { float x = s.nextFloat(); float y = s.nextFloat ...

1012

    博客分类:
  • Java
从1打到13     public class Main { public static void main(String[] args) { new Main(); } public Main() { for (int i = 1; i < 14; i++) { System.out.println(i + "\t" + exec(i)); } } public int exec(int n) { for (int i = 0;; i += n + 1) { if (check(n, n + 1 ...
仿人的,很奇怪1、2、3一处也不能少,但没找着少了之后结果会不同的测试数据   import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main(); } public Main() { Scanner s = new Scanner(System.in); while (true) { BigDecimal n = s.nextBigDecimal(); ...
import java.util.Scanner; public class Main { public static void main(String[] args) { new Main(); } public Main() { Scanner s = new Scanner(System.in); float n; while ((n = s.nextFloat()) != 0) { int i = 1; while ((n -= (1.0 / ++i)) > 0) { } System.out.pri ...
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main(); } int count;// 数字个数 int[] a; boolean[] b; int L;// 当前匹配长度 ...
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Scanner; import java.util.TreeMap; public class Main1 { public static void main(String[] args) { new Main1(); } int l; p ...
Global site tag (gtag.js) - Google Analytics