herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
你會用C的算子sizeof?
-
Python C++使用字串find迴圈速解Leetcode 2490 Circular Sentence C++ & Python都有字串的find,用法都類似 split=s.find(' ', split+1)能找到s從index=split+1開...
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
51 則留言:
D10333034 洪芷茵
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class D039 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rcd=new Random();
Scanner input=new Scanner(System.in);
int x=rcd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0~9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
D10333040 王崇安
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1, 2,....9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
class ex1
{
public static void main (String[] args)
{
Random rnd = new Random();
int x = rnd.nextInt(10);
System.out.println("請輸入:0,1,2,...,9");
Scanner inp = new Scanner(System.in);
int y = -1;
while (x!=y)
{
y = inp.nextInt();
if (x==y)
System.out.println("恭喜答對了");
else if (x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, ..., 10:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class ex01 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.Random;
import java.util.Scanner;
public class joneswang1314 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1 , 2,......,10:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("在大一點!");
else if(x<y)
System.out.println("在小一點!");}}}
import java.util.*;
public class ex01 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hello0518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜, 1, 2,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0 , 1,2,...,9:");
y=input.nextInt();
if ( x==y)
System.out.print("猜對了!");
else if ( x>y)
System.out.print("再大一點!");
else
System.out.print("在小一點!");
}
System.out.print("x="+x);
}
}
import java.util.Random;
import java.util.*;
public class jimmy_0518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int a=rnd.nextInt(10);
int b=-1;
while(a!=b){
System.out.println("猜0,1,2,.....9:");
b=input.nextInt();
if(a==b)
System.out.println("猜對了");
else if(a>b)
System.out.println("再大一點");
else if(a<b)
System.out.println("再小一點");
}
System.out.println("A="+a);
}
}
import java.util.Scanner;
public class bb123 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(100);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,99");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else
System.out.println("猜錯了!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System .out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.Random;
import java.util.Scanner;
public class gtr {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class tx1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小歇");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
D10333010 柯羿瑄
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if ( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");
}
System.out.println("x="+x);
}
}
import java.util.Random;
import java.util.Scanner;
public class joneswang1314 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=1;
while(x!=y){
System.out.println("猜0, 1 , 2,......,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("在大一點!");
else if(x<y)
System.out.println("在小一點!");}}}
import java.util.*;
public class LOL {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
D10333033 江淑婷
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hi123 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
Y10310066 陳昤瑄
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("在小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class B10033104 {
public static void main(String[]args){
Random rnd =new Random();
Scanner input =new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0~9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.Random;
import java.util.Scanner;
public class gtr {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
class ex1
{
public static void main (String[] args)
{
Random rnd = new Random();
int x = rnd.nextInt(10);
System.out.println("請輸入:0,1,2,...,9");
Scanner inp = new Scanner(System.in);
int y = -1;
while (x!=y)
{
y = inp.nextInt();
if (y>9 || y<0)
System.out.println("請輸入0-9");
else if (x==y)
System.out.println("恭喜答對了");
else if (x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
}
}
import java.util.*;
public class tx1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極炸彈1~9");
y=input.nextInt();
if (y>9 || y<0)
System.out.println("不要鬧要輸入0~9");
else if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小些");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hello518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,......,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hello518 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,......,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
package happ;
import java.util.*;
public class abc {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.Random;
import java.util.Scanner;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1 , 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
mport java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}
}
mport java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}
}
import java.util.Random;
import java.util.Scanner;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("猜0, 1, 2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class Promise {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!!!");
else if( x>y)
System.out.println("再大一點!!!");
else
System.out.println("再小一點!!!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int X=rnd.nextInt(100);
int y=1;
while(X!=y){
System.out.println("猜0, 1 , 2,...,9:");
y=input.nextInt();
if( X==y)
System.out.println("猜對了!");
else if( X>y)
System.out.println("再大一點");
else
System.out.println("再小一點!");
}
System.out.println("x="+X);
}
}
import java.util.Random;
import java.util.Scanner;
public class gtr {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
D10033301江姿穎 提到...
import java.util.*;
public class tx1 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小歇");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
mport java.util.*;
class ex1
{
public static void main (String[] args)
{
Random rnd = new Random();
int x = rnd.nextInt(10);
System.out.println("請輸入:0,1,2,...,9");
Scanner inp = new Scanner(System.in);
int y = -1;
while (x!=y)
{
y = inp.nextInt();
if (x==y)
System.out.println("恭喜答對了");
else if (x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
}
}
public class d1033319 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}
import java.util.*;
public class D1003300333 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小些");
}
System.out.println("x="+x);
}
}
D10033203 黃琮崴
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("終極炸彈1~9");
y=input.nextInt();
if (y>9 || y<0)
System.out.println("不要鬧要輸入0~9");
else if( x==y)
System.out.println("恭喜爆炸了");
else if( x>y)
System.out.println("秒數再大些");
else
System.out.println("秒數在小點");
}
System.out.println("x="+x);
}
}
import java.util.Random;
import java.util.Scanner;
public class gtr {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(9);
int y=-1;
while(x!=y){
System.out.println("0,1,2,3,....9:");
y=input.nextInt();
if(x==y)
System.out.println("猜對了!");
else if(x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class hi {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,1,2,...,9:");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if ( x>y)
System.out.println("再大一點!");
else
System.out.println("再小一點!");
}
System.out.println("x="+x);
}
}
import java.util.*;
public class D10333038 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜看看密碼1~9");
y=input.nextInt();
if( x==y)
System.out.println("答對了");
else if( x>y)
System.out.println("數字再大些");
else
System.out.println("數字在小些");
}
System.out.println("x="+x);
}
}
20
public class d10033203 {
public static void main(String[] args) {
Random rnd=new Random();
Scanner input=new Scanner(System.in);
int x=rnd.nextInt(10);
int y=-1;
while(x!=y){
System.out.println("猜0,...,9");
y=input.nextInt();
if( x==y)
System.out.println("猜對了!");
else if( x>y)
System.out.println("再大一點");
else
System.out.println("再小一點");
}
System.out.println("x="+x);
}
張貼留言