D重叠面积

Description

zjahstu是个很厚道的ACMer,O(∩_∩)O~。。特为大家准备水题一道。。
题目很简单,两个矩形,告诉你矩形1,矩形2的面积和他们的总面积,请你求两矩形重叠部分的面积。如果给你的情况不存在,就输出Impossible。

Input

第一个数是T,表示测试数据的组数。 后面有T行,每行3个整数(1~10000)。

Output

输出阴影部分的面积或者Impossible。

Sample Input

3
20 20 40
20 20 30
20 20 50

Sample Output

0
10
Impossible
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n;
    int a,b,c;

    scanf("%d",&n);
    while(n--)
    {
       scanf("%d%d%d",&a,&b,&c);
       if (a+b>=c)
            printf("%d\n",a+b-c);
       else
        printf("Impossible\n");

    }
    return 0;
}


posted @ 2015-04-18 13:07  范晋豪  阅读(131)  评论(0编辑  收藏  举报