DESCRIPTION
Two octal number integers a, b are given, and you need calculate the result a - b in octal notation.
If the result is negative, you should use the negative sign instead of complement notation.
INPUT
The first line is an integer T(1 <= T <= 1000), indicating the number of test cases.For each case, the first and only line contains two octal integers a, b.(0 <= a, b < 2^32)
OUTPUT
Print the result, one per line, in octal notation.
SAMPLE INPUT
1
76 7
76 7
SAMPLE OUTPUT
67
直接用%o输出八进制就好了,但是这个有一个注意点就是int的范围会超,因为给出的无符号整形.所以要用long ,输出的时候用%lo就可以了
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--)
{
long a,b;
scanf("%lo%lo",&a,&b);
if(a>b)
printf("%lo\n",a-b);
else printf("-%lo\n",b-a);
}
return 0;
}