10055 - Hashmat the Brave Warrior

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/QQQZSJ/article/details/83310192

                          10055 - Hashmat the Brave Warrior

                                          Time limit : 3.000 seconds

Hashmat is a brave warrior【武士,勇士; 军人; 鼓吹战争的人; 】 who with his group of young soldiers moves from one place to another to fight against his opponents. Before Fighting he just calculates one thing, the difference between his soldier number and the opponent’s soldier number. From this difference he decides whether to fight or not. Hashmat’s soldier number is never greater than his opponent.
 

Input

The input contains two numbers in every line. These two numbers in each line denotes【代表; 指代; 预示; 意思是; 】 the number soldiers in Hashmat’s army and his opponent’s army or vice versa【反之亦然; 反过来也一样; 】. The input numbers are not greater than 2^32. Input is terminated by ‘End of File’.

Output

For each line of input, print the difference of number of soldiers between Hashmat’s army and his opponent’s army. Each output should be in seperate line.
 

Sample Input
10 12

10 14

100 200
Sample Output
2

4

100

code1:

//系 读不懂题目篇 
//第一次提交的尴尬代码 
#include<stdio.h>
#include<iostream>
using namespace std;

void outPut(long long  a,long long b)
{
	int count = 0;
	for(int i=a;i<b;i++)
	{
		count++;	
	}
	cout<<count<<endl;
}
int main()
{
	long long m,n;
	while(scanf("%lld%lld",&m,&n)!=EOF)
	{
		outPut(m,n);
	}
	return 0;
}

code2:

#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{
	long long m,n;
	while(scanf("%lld%lld",&m,&n)!=EOF)
	{
		cout<<n-m;
	}
	return 0;
}

code3: accepted 

#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{
	long long m,n;
	while(scanf("%lld%lld",&m,&n)!=EOF)
	{
		if (n-m>0) cout<<n-m;
        else cout<<m-n;
	}
	return 0;
}

收获不少。 

vice versa:

1. and vice versa ;

We gossip about them and vice versa. 我们在议论他们,他们也在议论我们。

and vice versa 通常跟在句子的最后,来表示「反之亦然」,and 前面的逗号可加可不加。

2. or vice versa ;

vice versa 还可以用来暗示「二选一」,这个时候得用 or vice versa:

Should I come to your house or vice versa? 是我去你家里,还是你来我家?

猜你喜欢

转载自blog.csdn.net/QQQZSJ/article/details/83310192