日期:2014-05-20 浏览次数:20818 次
public class Test { public static void main(String[] args) { int[] a={1,4,8,11,15,18}; int[] b={2,5,9,12,13,16}; int[] c={3,6,7,10,14,17}; for(int i=0;i<100;i++){ int num=nextInt(i); System.out.println(a[num/100%6]+","+b[(num/10)%10%6]+","+c[num%10%6]); } } //以下方法作者为bigbug9002 private static int nextInt(int index){ if(index<0){ throw new IllegalArgumentException("num must be positive number."); } double x=Math.abs(Math.cos(Math.sqrt(2)*(index+1))); double y=1.0*137/13/(index+1); double z=17*index*index+29*index+67; y=y-(int)y; while(y*10<1) y*=10; while(z>1) z/=7; x=x*z+y; String str=String.valueOf(x); str=str.substring(2); int start=index%13; return Integer.parseInt(str.substring(start,start+3)); } }