标签:style blog class code java tar
输入正好是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
1 #include <iostream> 2 #include <cstdio> 3 #include <cmath> 4 #include <algorithm> 5 using namespace std; 6 #define LL long long 7 8 int main() 9 { 10 int t; 11 LL x, y; 12 unsigned long long z; 13 scanf("%d", &t); 14 while(t--) 15 { 16 scanf("%lld%lld", &x, &y); 17 if(x > y) 18 z = x - y; 19 else 20 z = y - x; 21 printf("%llu\n", z); 22 } 23 return 0; 24 }
acdream B - 郭式树 (水题 卡cin,cout, 卡LL),布布扣,bubuko.com
acdream B - 郭式树 (水题 卡cin,cout, 卡LL)
标签:style blog class code java tar
原文地址:http://www.cnblogs.com/bfshm/p/3704483.html