public class java1224 {
! e' D( [0 r* L, G& J `7 q, a* R% A! B* M
public void main(String[]arg){6 |- Q- A* |6 C- d2 Z
int r[]=new int[42];
& H% Z6 P9 N& ]2 ?: p$ R for(int i=0;i<42;i++)" P# e9 _& \. ]* S/ ?# K8 T
{
! }6 G, S( c% t; \; V; Q r[i]=i+1;
$ K$ n2 i! R- M7 u! ~9 i }5 h5 N+ C9 p, s
for(int i=0;i<42;i++)
+ K3 `0 u' K- L1 D S' B {: g5 w0 N( j' g/ M2 N4 A. ~9 |
int rr=(int)(Math.random()*42);# M" U0 n3 ~2 M* t4 u/ m. l
int t=r[i];! }: h% b$ k6 ? @
r[i]=r[rr];1 s- R9 W$ g; q+ R! N6 J. a
r[rr]=t;8 y2 I) p+ C8 e* b2 p
}. d. q8 @) ]: X0 R0 f/ j/ e
for(int i=0;i<6;i++)3 x5 W$ ]: W/ L2 O( ^) @- \' m1 W
{
6 ?7 F. b' P6 b! e% K4 @; x* e //System.out.println("第"+(i+1)+"個號碼"+r[i]);
& g8 j0 V. @5 U System.out.printf("第%d個號碼:%02d",i+1,r[i]);9 o8 d& P" l) X
}% N/ t m/ ~/ a9 M0 |- @* E
//System.out.println("特別號:"+r[6]);* V' c9 H9 C: L: o0 ^
System.out.printf("特別號:%02d\n",r[6]); 7 y2 T; M/ ~ ^$ y" c( \) [3 Q( Y
}
8 A; T9 D! Y( F% H" I6 x/ R& }$ X6 f7 F
} |