Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2011
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class a005 {
  3. public static void main (String args[]) {
  4. Scanner cin = new Scanner(System.in);
  5. int t, a, b, c, d;
  6. t = cin.nextInt();
  7. while(t-- != 0) { //t-- 是好方法,不用for()來計算
  8. a = cin.nextInt(); //當變數少的時候,abcd比num[4]來得方便
  9. b = cin.nextInt();
  10. c = cin.nextInt();
  11. d = cin.nextInt();
  12. System.out.print(a + " " + b + " " + c + " " + d +" ");
  13. if(a-b == c-d)
  14. System.out.println(d+(d-c));
  15. else
  16. System.out.println(d*d/c);
  17. }
  18. }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement