Problem E. Distance
Input file: standard input
Output file: standard output
Time limit: 1 seconds Memory limit: 128 megabytes
We all know that big brother is the horse Pima big brother liked to live on the quiet side street, this street we compared a number line, every house in a
The integer points, and only one location on a house, there are two shops on this street, now a horse Gangster know the location of two stores, horse chiefs would like to ask you how much distance between the two stores are
For example: the position of the first store 1, store the second position is 3, the distance is 3-1 = 2
Input
A first line of input integer T, representative of the next set of test data with a T
Next T lines, each of the two numbers a and B input, respectively represent the location of the two stores
1 £ T £ 10000,1 £ n, m £ 10000
Output
For each set of test data corresponding to the output answer
Example
standard input |
standard output |
1 1 3 |
2 |
#include<iostream> #include<cmath> using namespace std; int main() { int t; cin >> t; while(t--) { int a,b; cin >> a >> b; cout << abs(a-b) << endl; } return 0; }