UVA 10055: Hashmat the brave warrior

Jasonlin posted @ 2011年3月25日 23:07 in UVA , 2619 阅读

题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=996

题目大意:

      输入两个军队数量,输出之间的差。

解题思路:

      水的不能再水啊~我居然错了4次~没有注意数据范围是2^32,用int和unsinged都不行阿~只能用long long。

看题要细心阿~~

解题代码:

#include<iostream>
using namespace std;
int main(){
    long long a,b;
    while(cin>>a>>b){
        cout<<(a>b?a-b:b-a)<<endl;
    }
    return 0;
}

扩展知识:http://www.cnblogs.com/card323/archive/2009/06/18/1505794.html

  • 无匹配
  • 无匹配

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter