AcDream 1079 郭氏数
2013-03-19 17:14
239 查看
题意:求出两点的距离。
解法:由于有一种情况相加将超出long long的最大表示范围,由于计算机将减法都视作是加法,因此溢出之后的值如果使用无符号格式控制符来输出的话,结果是对的。
代码如下:
解法:由于有一种情况相加将超出long long的最大表示范围,由于计算机将减法都视作是加法,因此溢出之后的值如果使用无符号格式控制符来输出的话,结果是对的。
代码如下:
#include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <algorithm> using namespace std; int main() { int T; scanf("%d", &T); while (T--) { long long int x, y, Max, Min; scanf("%lld %lld", &x, &y); Max = x > y ? x : y; Min = x < y ? x : y; printf("%llu\n", Max - Min); } return 0; }
相关文章推荐
- ACdream 1079 Walking in the Rain (线性dp)
- ACdream 1079 郭式树
- 程序设计中数学很重要(杭电1079)
- 解决:windows无法启动windows audio服务{位于本地计算机上}错误1079,此服务的账户不同于运行同一进程上的其他服务的账户
- ACdream 1022
- ACdream 某群赛某题 Classification of the species
- AcDream 1081 平衡树 Tire树
- 1079 回家
- 杭电ACM HDU 1079 Calendar Game(转)
- HDU 1079 日期游戏 博弈论相关
- pat 1079 another solution
- Acdream 1081 梦
- HDU 1079 Calendar Game (博弈论-sg)
- ACdream 1127(Base Station-树状数组-2个约束条件)
- ACdream 1064 完美数
- ACdream 1148 GCD SUM(数学:推理+数论:莫比乌斯函数)
- ACdream 1148 GCD SUM 莫比乌斯反演
- acdream 1043 Always Turn Left(模拟)
- 快速切题 acdream手速赛(6)A-C
- 【ACdream】1070 神奇的%系列二