Problem Description

Hashmat是一個勇敢的將領,他帶著年輕的士兵從這個城市移動到另一個城市與敵人對抗。在打仗之前他會計算己方與敵方士兵的數目差距,來決定是要開打或不開打。Hashmat的士兵數絕不會比敵人的士兵數大。 

Input Format

每組測試資料1列,有2個整數,代表Hashmat及敵人的士兵數或反之。這些數不會超過263

Output Format

對每組測試資料請輸出Hashmat與敵人士兵數目的差(正數)。

Sample Input

10     12
14     10

Sample Output

2
4


-----*Problem from【ZeroJudge, An Online Judge System For Beginners

 

My Answer

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
#include<iostream>
using namespace std;
int main(void)
{
   long long int a, b;
   while(cin>>a>>b){
      (a>b) ? cout<<a-b<<endl : cout<<b-a<<endl;
   }
   return 0;
}


 


arrow
arrow
    全站熱搜

    兔老大 發表在 痞客邦 留言(0) 人氣()