输入正好是long long的最大, 但是答案超long long
所以用unsigned, 不能用cin cout否则一定超时;
不能用abs(), abs 只用于整数。
unsigned int 0~4294967295
int 2147483648~2147483647
unsigned long 0~4294967295
long 2147483648~2147483647
long long的最大值:9223372036854775807
long long的最小值:-9223372036854775808
unsigned long long的最大值:18446744073709551615
__int64的最大值:9223372036854775807
__int64的最小值:-9223372036854775808
unsigned __int64的最大值:18446744073709551615
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define LL long long int main()
{
int t;
LL x, y;
unsigned long long z;
scanf("%d", &t);
while(t--)
{
scanf("%lld%lld", &x, &y);
if(x > y)
z = x - y;
else
z = y - x;
printf("%llu\n", z);
}
return ;
}