andre_joy

导航

UVa 10055

地址:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=996

题意:给军官和敌人的士兵数,求两个人士兵数的差值。

mark:UVa第一题,wa了5次。。学到两点!

    1.unsigned  [0,2^32-1],signed [-2^31, 2^31-1]。

    2. vice versa 翻译为 反之亦然。

代码:

#include <stdio.h>

int main()
{
    long long a,b;
    while(scanf("%lld%lld", &a, &b) != EOF)
    {
        if(a > b) a ^= b ^= a ^= b;
        printf("%lld\n", b-a);
    }
    return 0;
}

 

 

 

posted on 2012-07-12 15:53  andre_joy  阅读(149)  评论(1编辑  收藏  举报