a005.
Eva 的回家作業
--
POJ
| From: [118.171.85.67] |
發表日期
:
2012-03-28 01:29
import java.util.Scanner;
public class a005 {
public static void main (String args[])
{
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
int t=cin.nextInt();
if(t>=0 & t<=20)
{
int [][] row = new int [t][5];
for(int j=0;j<=(row.length-1);j++)
{
for(int k=0;k<=(row[j].length-2);k++)
{
row[j][k]=cin.nextInt();
}
}
for(int j=0;j<=row.length-1;j++)
{
if((row[j][3]-row[j][2])==(row[j][2]-row[j][1]) & (row[j][2]-row[j][1])==(row[j][1]-row[j][0]))
{
row[j][4]=row[j][3]+(row[j][3]-row[j][2]);
}
else if((row[j][3]/row[j][2])==(row[j][2]/row[j][1]) & (row[j][2]/row[j][1])==(row[j][1]/row[j][0]))
{
row[j][4]=row[j][3]*(row[j][3]/row[j][2]);
}
}
for(int j=0;j<=(row.length-1);j++)
{
for(int k=0;k<=(row[j].length-1);k++)
{
System.out.print(row[j][k]+" ");
}
}
}
}
}
}