輸入出生年份,輸出生肖
參考解答:
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
你會用C的算子sizeof?
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
-
C++ DP動態規劃解Leetcode 937 Maximum Number of Points with Cost 有些標示medium要比標示hard的問題還要難,Leetcode 1937. Maximum Number of Points with Cost,DP動態規...
27 則留言:
import java.util.Scanner;
public class aa {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("輸入出生年");
x=input.nextInt();
y=(x-1600)%12;
if(y==0)
System.out.print("鼠");
else if(y==1)
System.out.print("牛");
else if(y==2)
System.out.print("虎");
else if(y==3)
System.out.print("兔");
else if(y==4)
System.out.print("龍");
else if(y==5)
System.out.print("蛇");
else if(y==6)
System.out.print("馬");
else if(y==7)
System.out.print("羊");
else if(y==8)
System.out.print("猴");
else if(y==9)
System.out.print("雞");
else if(y==10)
System.out.print("狗");
else if(y==11)
System.out.print("豬");
}
}
import java.util.Scanner;
public class ex01 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int x; int r;
Scanner input=new Scanner (System.in);
System.out.print("出生年份");
x=input.nextInt();
r=(x-1960)%12;
r=(r+12)%12;
if(r==0)
System.out.print("生肖鼠");
else if(r==1)
System.out.print("生肖牛") ;
else if(r==2)
System.out.print("生肖虎") ;
else if(r==3)
System.out.print("生肖兔") ;
else if(r==4)
System.out.print("生肖龍") ;
else if(r==5)
System.out.print("生肖蛇") ;
else if(r==6)
System.out.print("生肖馬") ;
else if(r==7)
System.out.print("生肖羊") ;
else if(r==8)
System.out.print("生肖猴") ;
else if(r==9)
System.out.print("生肖雞") ;
else if(r==10)
System.out.print("生肖狗") ;
else
System.out.print("生肖豬") ;
}
}
import java.util.Scanner;
public class c1 {
public static void main(String[] args) {
int x, j;
Scanner input =new Scanner(System.in);
System.out.println("請輸入(西元)年號");
x=input.nextInt();
j=(x-1960)%12;
System.out.println("生肖");
if(j==0)
System.out.println("鼠");
if(j==1)
System.out.println("牛");
if(j==2)
System.out.println("虎");
if(j==3)
System.out.println("兔");
if(j==4)
System.out.println("龍");
if(j==5)
System.out.println("蛇");
if(j==6)
System.out.println("馬");
if(j==7)
System.out.println("羊");
if(j==8)
System.out.println("猴");
if(j==9)
System.out.println("雞");
if(j==10)
System.out.println("狗");
if(j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class h14 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else
System.out.println("豬");
}
}
import java.util.Scanner;
public class house1016 {
public static void main(String[] args) {
int x, j;
Scanner input =new Scanner(System.in);
System.out.println("年號");
x=input.nextInt();
j=(x-1960)%12;
System.out.println("生肖");
if(j==0)
System.out.println("鼠");
if(j==1)
System.out.println("牛");
if(j==2)
System.out.println("虎");
if(j==3)
System.out.println("兔");
if(j==4)
System.out.println("龍");
if(j==5)
System.out.println("蛇");
if(j==6)
System.out.println("馬");
if(j==7)
System.out.println("羊");
if(j==8)
System.out.println("猴");
if(j==9)
System.out.println("雞");
if(j==10)
System.out.println("狗");
if(j==11)
System.out.println("豬");
}
}
import java.util.*;
public class ex1 {
public static void main(String[] args) {
int x, j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960+12)%12);
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else
System.out.println("豬");
}
}
import java.util.Scanner;
public class e19 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.println("出生年份");
x=input.nextInt();
y=((x-1960)+12)%12;
if(y==0)
System.out.println("鼠");
else if(y==1)
System.out.println("牛");
else if(y==2)
System.out.println("虎");
else if(y==3)
System.out.println("兔");
else if(y==4)
System.out.println("龍");
else if(y==5)
System.out.println("蛇");
else if(y==6)
System.out.println("馬");
else if(y==7)
System.out.println("羊");
else if(y==8)
System.out.println("猴");
else if(y==9)
System.out.println("雞");
else if(y==10)
System.out.println("狗");
else
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex_01 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex_01 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex1016 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if (j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex1016 {
public static void main(String[] args) {
int x,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
x=input.nextInt();
j=((x-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class vghj858 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("給我你的出生年份");
x=input.nextInt();
y=(x-1192)%12;
if (y==0)System.out.print("mouse");
else if (y==1)System.out.print("cow");
else if (y==2)System.out.print("tiger");
else if (y==3)System.out.print("rabbit");
else if (y==4)System.out.print("dragon");
else if (y==5)System.out.print("snake");
else if (y==6)System.out.print("horse");
else if (y==7)System.out.print("goat");
else if (y==8)System.out.print("monkey");
else if (y==9)System.out.print("chicken");
else if (y==10)System.out.print("dog");
else if (y==11)System.out.print("PIG");
}
}
import java.util.Scanner;
public class ex1 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("出生年:");
int x=input.nextInt();
int r;
r=(x-1960)%12;
r=(r+12)%12;
if (r==0) System.out.print("鼠年");
else if (r==1) System.out.print("牛年");
else if (r==2) System.out.print("虎年");
else if (r==3) System.out.print("兔年");
else if (r==4) System.out.print("龍年");
else if (r==5) System.out.print("蛇年");
else if (r==6) System.out.print("馬年");
else if (r==7) System.out.print("羊年");
else if (r==8) System.out.print("猴年");
else if (r==9) System.out.print("雞年");
else if (r==10) System.out.print("狗年");
else if (r==11) System.out.print("豬年");
}
}
import java.util.Scanner;
public class happy2 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("出生年份");
x=input.nextInt();
y=(x-1960)%12;
if (y==0)System.out.print("鼠");
else if (y==1)System.out.print("牛");
else if (y==2)System.out.print("虎");
else if (y==3)System.out.print("兔");
else if (y==4)System.out.print("龍");
else if (y==5)System.out.print("蛇");
else if (y==6)System.out.print("馬");
else if (y==7)System.out.print("羊");
else if (y==8)System.out.print("猴");
else if (y==9)System.out.print("雞");
else if (y==10)System.out.print("狗");
else if (y==11)System.out.print("豬");
}
}
import java.util.Scanner;
public class vghj858 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("給我你的出生年份");
x=input.nextInt();
y=(x-1192)%12;
if (y==0)System.out.print("mouse");
else if (y==1)System.out.print("cow");
else if (y==2)System.out.print("tiger");
else if (y==3)System.out.print("rabbit");
else if (y==4)System.out.print("dragon");
else if (y==5)System.out.print("snake");
else if (y==6)System.out.print("horse");
else if (y==7)System.out.print("goat");
else if (y==8)System.out.print("monkey");
else if (y==9)System.out.print("chicken");
else if (y==10)System.out.print("dog");
else if (y==11)System.out.print("PIG");
}
}
import java.util.Scanner;
public class vghj858 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.print("給我你的出生年份");
x=input.nextInt();
y=(x-1192)%12;
if (y==0)System.out.print("mouse");
else if (y==1)System.out.print("cow");
else if (y==2)System.out.print("tiger");
else if (y==3)System.out.print("rabbit");
else if (y==4)System.out.print("dragon");
else if (y==5)System.out.print("snake");
else if (y==6)System.out.print("horse");
else if (y==7)System.out.print("goat");
else if (y==8)System.out.print("monkey");
else if (y==9)System.out.print("chicken");
else if (y==10)System.out.print("dog");
else if (y==11)System.out.print("PIG");
}
}
import java.util.Scanner;
public class e029 {
public static void main(String[] args) {
int x,y;
Scanner input=new Scanner(System.in);
System.out.println("出生年份");
x=input.nextInt();
y=((x-1960)+12)%12;
if(y==0)
System.out.println("鼠");
else if(y==1)
System.out.println("牛");
else if(y==2)
System.out.println("虎");
else if(y==3)
System.out.println("兔");
else if(y==4)
System.out.println("龍");
else if(y==5)
System.out.println("蛇");
else if(y==6)
System.out.println("馬");
else if(y==7)
System.out.println("羊");
else if(y==8)
System.out.println("猴");
else if(y==9)
System.out.println("雞");
else if(y==10)
System.out.println("狗");
else
System.out.println("豬");
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class A10433043 {
public static void main(String[] args) {
int X,j;
Scanner input=new Scanner(System.in);
System.out.println("請輸入年份");
X=input.nextInt();
j=((X-1960)+12)%12;
if(j==0)
System.out.println("鼠");
else if (j==1)
System.out.println("牛");
else if (j==2)
System.out.println("虎");
else if (j==3)
System.out.println("兔");
else if (j==4)
System.out.println("龍");
else if (j==5)
System.out.println("蛇");
else if (j==6)
System.out.println("馬");
else if (j==7)
System.out.println("羊");
else if (j==8)
System.out.println("猴");
else if (j==9)
System.out.println("雞");
else if (j==10)
System.out.println("狗");
else if (j==11)
System.out.println("豬");
}
}
import java.util.Scanner;
public class ex {
public static void main(String[] args) {
Scanner z =new Scanner(System.in );
System.out.print("輸入出生年份:");
int b=z.nextInt();
int x ;
x=(b-100)%12;
if (x==0) System.out.print("鼠");
else if (x==1) System.out.print("牛");
else if (x==2) System.out.print("虎");
else if (x==3) System.out.print("兔");
else if (x==4) System.out.print("龍");
else if (x==5) System.out.print("蛇");
else if (x==6) System.out.print("馬");
else if (x==7) System.out.print("羊");
else if (x==8) System.out.print("猴");
else if (x==9) System.out.print("雞");
else if (x==10) System.out.print("狗");
else if (x==11) System.out.print("豬");
}
import java.util.Scanner;
public class Ex01166 {
public static void main(String[] args) {
Scanner z=new Scanner(System.in);
System.out.print("輸入出生年份:");
int b=z.nextInt();
int x;
x=(b-1960)%12;
if(x==0)System.out.print("鼠");
else if(x==1)System.out.print("牛");
else if(x==2)System.out.print("虎");
else if(x==3)System.out.print("兔");
else if(x==4)System.out.print("龍");
else if(x==5)System.out.print("蛇");
else if(x==6)System.out.print("馬");
else if(x==7)System.out.print("羊");
else if(x==8)System.out.print("猴");
else if(x==9)System.out.print("雞");
else if(x==10)System.out.print("狗");
else if(x==11)System.out.print("豬");
}
}
import java.util.Scanner;
public class a123 {
public static void main(String[] args) {
System.out.print("出生年份");
Scanner input=new Scanner(System.in);
int x=input.nextInt();
x=(x-1960)%12;
if(x<0) x+=12;
String xx="鼠牛虎兔龍蛇馬羊猴雞狗豬";
System.out.println(xx.charAt(x));
}
}
package jimmy;
import java.util.Scanner;
public class good {
public static void main(String[] args) {
Scanner a =new Scanner(System.in);
System.out.print("輸入出生年份:");
int b= a.nextInt();
int c; c=(b-1960)%12;
if (c==0)System.out.print("鼠");
else if(c==1)System.out.print("牛");
else if(c==2)System.out.print("虎");
else if(c==3)System.out.print("兔");
else if(c==4)System.out.print("龍");
else if(c==5)System.out.print("蛇");
else if(c==6)System.out.print("馬");
else if(c==7)System.out.print("羊");
else if(c==8)System.out.print("侯");
else if(c==9)System.out.print("雞");
else if(c==10)System.out.print("狗");
else if(c==11)System.out.print("豬");
package jimmy;
import java.util.Scanner;
public class good {
public static void main(String[] args) {
Scanner a =new Scanner(System.in);
System.out.print("輸入出生年份:");
int b= a.nextInt();
int c; c=(b-1960)%12;
if (c==0)System.out.print("鼠");
else if(c==1)System.out.print("牛");
else if(c==2)System.out.print("虎");
else if(c==3)System.out.print("兔");
else if(c==4)System.out.print("龍");
else if(c==5)System.out.print("蛇");
else if(c==6)System.out.print("馬");
else if(c==7)System.out.print("羊");
else if(c==8)System.out.print("侯");
else if(c==9)System.out.print("雞");
else if(c==10)System.out.print("狗");
else if(c==11)System.out.print("豬");
}
}
package jimmy;
import java.util.Scanner;
public class good {
public static void main(String[] args) {
Scanner a =new Scanner(System.in);
System.out.print("輸入出生年份:");
int b= a.nextInt();
int c; c=(b-1960)%12;
if (c==0)System.out.print("鼠");
else if(c==1)System.out.print("牛");
else if(c==2)System.out.print("虎");
else if(c==3)System.out.print("兔");
else if(c==4)System.out.print("龍");
else if(c==5)System.out.print("蛇");
else if(c==6)System.out.print("馬");
else if(c==7)System.out.print("羊");
else if(c==8)System.out.print("侯");
else if(c==9)System.out.print("雞");
else if(c==10)System.out.print("狗");
else if(c==11)System.out.print("豬");
}
}
張貼留言