#14199: a005 測試OK執行時出現您總共輸出兩行


lion888 (Lion)

學校 : 不指定學校
編號 : 80932
來源 : [1.163.194.69]
最後登入時間 :
2018-06-27 19:52:21
a005. Eva 的回家作業 -- POJ | From: [1.161.185.210] | 發表日期 : 2018-06-26 01:22

package practice;

import java.util.Scanner;

public class no004 {

public static void main(String[] args) {
// TODO Auto-generated method stub

Scanner scn = new Scanner(System.in);
int line = scn.nextInt();
int i1,i2,i3,i4;

while(0 < line && line <=20) {

i1=scn.nextInt();
i2=scn.nextInt();
i3=scn.nextInt();
i4=scn.nextInt();

int n1 = i4-i3,n2 = i3-i2;
int d1 = i4/i3,d2 = i3/i2;
if(n1==n2 ) {

for(int j = 0 ;j < 5 ;j++) {
System.out.print(i1 + (i2-i1)*j + " ");
}
System.out.println();
}else if(d1==d2) {
int r = i2/i1;
for(int j = 0 ;j < 5 ;j++) {
int n = (int) Math.pow(r,j);
System.out.print(i1*n+" ");
}
break;
}

line--;

}


}

}

 
ZeroJudge Forum