a005.
Eva 的回家作業
--
POJ
| From: [1.161.172.78] |
發表日期
:
2013-09-14 21:19
我有個疑問,,題目上的第一個input 2是什麼意思?
試問這個程式run幾次的意思嗎?
謝謝
import java.util.Scanner;
public class J005 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int counter = sc.nextInt();
while (counter != 0) {
int[] abcd = new int[5];
for (int i = 0; i <= 3; i++) {
abcd[i] = sc.nextInt();
}
if (abcd[3] - abcd[2] == abcd[2] - abcd[1]) {
abcd[4] = abcd[3] + (abcd[3] - abcd[2]);
} else {
abcd[4] = abcd[3] * (abcd[3] / abcd[2]);
}
for (int s = 0; s <= 4; s++) {
System.out.print(abcd[s] + " ");
}
counter--;
}
}
}