a005.
Eva 的回家作業
--
POJ
| From: [1.161.28.22] |
發表日期
:
2015-04-08 02:02
import java.util.Scanner;
class MyNet{
public static void main(String[] args){
Scanner reader =new Scanner(System.in);
while(reader.hasNext()){
int layer=reader.nextInt();
int[][] numbers=new int[layer][4];
for(int i=0;i<layer;i++){
for(int j=0;j<4;j++){
numbers[i][j]=reader.nextInt();
}
}
for(int i=0;i<layer;i++){
int tmp1,tmp2,tmp3;
tmp1=numbers[i][0]-numbers[i][1];
tmp2=numbers[i][2]-numbers[i][3];
tmp3=numbers[i][1]-numbers[i][2];
if((tmp1==tmp2)&&(tmp2==tmp3)){
for(int j=0;j<4;j++)
System.out.print(numbers[i][j]+" ");
System.out.println(numbers[i][3]-(tmp3));
}
tmp1=numbers[i][1]/numbers[i][0];
tmp2=numbers[i][2]/numbers[i][1];
tmp3=numbers[i][3]/numbers[i][2];
if((tmp1==tmp2)&&(tmp2==tmp3)){
for(int j=0;j<4;j++)
System.out.print(numbers[i][j]+" ");
System.out.println(numbers[i][3]*(tmp3));
}
}
}
}
}