#18753: JAVA求幫忙 不知道為何結果永遠都是WA


Xian0321 (Xian)

學校 : 國立臺中高級家事商業職業學校
編號 : 91118
來源 : [111.252.164.2]
最後登入時間 :
2020-07-10 15:13:27
a003. 兩光法師占卜術 | From: [111.252.160.92] | 發表日期 : 2019-08-04 12:48

import java.util.Scanner;

public class a001 {

public static void main(String[] args) {
Scanner scanner= new Scanner(System.in);
System.out.println("請輸入月份:");
int M,D;
while (scanner.hasNext()) {
M = scanner.nextInt();
System.out.println("請輸入日期:");
while (scanner.hasNext()) {
D = scanner.nextInt();
int S = (M*2+D)%3;
if (S==0){
System.out.println("普");
}else
if(S==1){
System.out.println("吉");
}else
System.out.println("大吉");



}
}
}
}

 
#21474: Re:JAVA求幫忙 不知道為何結果永遠都是WA


z0919116365@gmail.com (日青可可)

學校 : 不指定學校
編號 : 117639
來源 : [122.121.56.138]
最後登入時間 :
2022-01-05 20:03:48
a003. 兩光法師占卜術 | From: [220.143.3.209] | 發表日期 : 2020-06-08 01:50

import java.util.Scanner;

public class a001 {

public static void main(String[] args) {
Scanner scanner= new Scanner(System.in);

int M,D;
while (scanner.hasNext()) {
M = scanner.nextInt();

while (scanner.hasNext()) {
D = scanner.nextInt();
int S = (M*2+D)%3;
if (S==0){
System.out.println("普通");
}else
if(S==1){
System.out.println("吉");
}else
System.out.println("大吉");



}
}
}
}

改這樣就過囉,你再看看

 
ZeroJudge Forum