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; }