PKU 2301 "Beat the Spread!"

問題:http://acm.pku.edu.cn/JudgeOnline/problem?id=2301
順位:http://acm.pku.edu.cn/JudgeOnline/problemstatus?problem_id=2301&orderby=clen&language=2

提出コード(203B)

import java.util.*;class Main{static{Scanner s=new Scanner(System.in);for(int g,d,c,n=s.nextInt();n-->0;){g=s.nextInt();d=s.nextInt();System.out.println((c=g-d)%2>0||c<0?"impossible":(g+d)/2+" "+c/2);}}}

整形コード

class Main {
	static {
		Scanner s = new Scanner(System.in);
		for (int g, d, c, n = s.nextInt(); n-- > 0;) {
			g = s.nextInt();
			d = s.nextInt();
			System.out.println((c = g - d) % 2 > 0 || c < 0 ? "impossible"
					: (g + d) / 2 + " " + c / 2);
		}
	}
}