|
public class Test1 {
static int k = 0;
; static final String [] s = {"1", "2", "3", "4", "5"};
public static void getOne (String ret, int pos) {
if (pos> = 4) {
System.out.println (ret);
k = k + 1;
return;
}
for (int i = 0; i <s.length; i ++) {
ret + = s [i];
getOne (ret, pos + 1);
ret = ret.substring (0, pos-1);
}
}
public static void main (String [] args) {
String num = "";
getOne (num, 1);
System.out.println (k);
}
}
If I only get 5th and 4th place, what should I do? |
|