UvaOJ 10055

     UvaOJ上做的第一道题,简单,但是不是那么容易就能拿到AC。有两点需要注意:

     1.输入数字不超过2^32,因此需要选用long long int类型(8字节)。long int不行,也是4字节。

     附加MSDN解释:

      int

      32-bit integer. On 16-bit platforms, cannot appear in remote functions without a size qualifier such as short, small, long or hyper.

      long

      32-bit integer.

     2.输入的数值不一定就是前面为Hashmat's soldiers,因此需要对大小进行判断,否则结果可能出现负值。

 

#include <stdio.h>
int main()
{
        long long int a, b;
        while(scanf("%lld %lld", &a, &b) != EOF)
                if(b > a)
                        printf("%lld\n", b - a);
                else
                        printf("%lld\n", a - b);
        return 0;
}

你可能感兴趣的:(uva)