本帖最後由 johnson 於 2012-2-18 12:00 編輯
# T$ {! x7 S6 C. s/ p( K/ I2 V9 \8 |9 `" A7 \
import java.util.*;
* ?! X& c/ r/ @: G. xpublic class j201- ~ \9 Z) P+ O6 [
{
% I, F) U; W3 D) H6 }* y public static void main(String arg[])
+ W+ F h: b& A* G2 h; G1 z {+ E( \# F/ X% a& D: h
Scanner s=new Scanner(System.in);
1 h q; s7 n. _0 A* T5 Z8 b; U# g System.out.print("請輸入Z可能的最大值:");+ a6 J2 L6 a% P" L4 O" }
int z=Integer.parseInt(s.next());
3 a, ], @: z6 T int temp;; V, d" x8 u3 Q: @+ h; T
for(int x=1;x<=10;x++)* u) S; X" r, c) h" k) Z+ W
{
; L1 o7 v; q+ c" Y; {( e int y=x*x*3+x*2+1;
) t _2 ^ Z8 N O% ^3 r; n if(y<z)
H2 q1 F x$ t {9 i P8 I7 n+ p2 D# W1 @. k' F/ e
System.out.printf("x=%d,Y=%d,Z=%d,符合Y<Z的條件");5 m, k: k! z; i% q9 V8 _! ^2 @! r
break;
/ q, d9 w& C: r0 |+ _+ | }; t- n7 p! {. S' i7 P, m k$ ~/ X
temp=y;3 o. n* J# H0 F
}1 h/ Q& e6 Q# |
}
5 @, C# H( C3 ^} |