a005.
Eva 的回家作業
--
POJ
| From: [118.171.192.42] |
發表日期
:
2015-06-30 17:02
import java.util.Scanner;
public class text3 {
public static void main(String[] args) {
Scanner sever = new Scanner(System.in);
while (sever.hasNext())
{
String ss = sever.nextLine();
int n = Integer.parseInt(ss);
int nn=0;
if (0 <= n && n <= 20)
{
for (int i=0;i<n;i++)
{
ss = sever.nextLine();
String[] number=ss.split(" ");
if (Integer.parssInt(number[1])-Integer.parssInt(number[0]) == Integer.parssInt(number[2])-Integer.parssInt(number[1]))
{
nn=Integer.parssInt(number[1])-Integer.parssInt(number[0]);
System.out.println(ss + " " + Integer.parssInt(number[3])+nn);
}
else
{
nn=Integer.parssInt(number[1])\Integer.parssInt(number[0]);
System.out.println(ss + " " + Integer.parssInt(number[3])*nn);
}
}
}
}
}
}