aiheshan

有多自律,才能有多自由

导航

UVa 10055 - Hashmat the Brave Warrior

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=show_problem&problem=996

解题思路:求两个数差值的绝对值,注意用long;

 1 #include<iostream>
 2 using namespace std;
 3  
 4 int main()
 5 {
 6    long a,b;
 7    while(cin>>a>>b)
 8        {
 9            if(b>a)
10            cout<<b-a<<endl;
11            else
12            cout<<a-b<<endl;
13        }
14    return 0;
15 }

 

posted on 2016-08-03 16:18  aiheshan  阅读(109)  评论(0编辑  收藏  举报