当前位置: 代码迷 >> 综合 >> HDOJ 1194 Beat the Spread!
  详细解决方案

HDOJ 1194 Beat the Spread!

热度:125   发布时间:2023-10-21 19:46:30.0

HDACM1194

翻译题…

import java.util.Scanner;public class Main{public static void main(String[] args) {Scanner sc= new Scanner(System.in);int n = sc.nextInt();while (n-->0) {int a = sc.nextInt();int b = sc.nextInt();int x = (a+b)/2;int y = (a-b)/2;if (x<0||y<0||(a+b)%2 != 0||(a-b)%2 != 0) {System.out.println("impossible");}else {System.out.println(x+" "+y);}}}
}
  相关解决方案