题目

输入正好是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 ;
}

acdream B - 郭式树 (水题 卡cin,cout, 卡LL)的更多相关文章

  1. acdream.郭式树(数学推导)

    郭式树 Time Limit:2000MS     Memory Limit:128000KB     64bit IO Format:%lld & %llu Submit Status Pr ...

  2. POJ 3468 A Simple Problem with Integers(线段树水题)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 135904 ...

  3. hdu 1754 I Hate It(线段树水题)

    >>点击进入原题测试<< 思路:线段树水题,可以手敲 #include<string> #include<iostream> #include<a ...

  4. hdu1305 字典树水题

    题意:      给你一些字符串,然后问你他们中有没有一个串是另一个串的前缀. 思路:       字典树水题,(这种水题如果数据不大(这个题目不知道大不大,题目没说估计不大),hash下也行,把每个 ...

  5. 【wikioi】1191 数轴染色(线段树+水题)

    http://wikioi.com/problem/1191/ 太水的线段树了,敲了10分钟就敲完了,但是听说还有一种并查集的做法?不明觉厉. #include <cstdio> #inc ...

  6. codeforces 339C Xenia and Bit Operations(线段树水题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Xenia and Bit Operations Xenia the beginn ...

  7. P1198 最大数 线段树水题

    这道题模拟一下可以过,但是我们发现线段树也可以安全水过...... 写的线段树只需要滋磁单点修改,区间求max即可 我一开始犯了一个很SB的错误:每次插入修改了t,然后疯狂爆0到怀疑人生... 而且我 ...

  8. HDU 1247 - Hat’s Words - [字典树水题]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1247 Problem DescriptionA hat’s word is a word in the ...

  9. BZOJ 3253 Fence Repair 哈夫曼树 水题

    http://poj.org/problem?id=3253 这道题约等于合并果子,但是通过这道题能够看出来哈夫曼树是什么了. #include<cstdio> #include<c ...

随机推荐

  1. 微软职位内部推荐-Principal Dev Manager

    微软近期Open的职位: Title: Principal Dev Manager Location: Beijing The R&D of Shared Data Platform at S ...

  2. 【转载】IE6 PNG透明终极解决方案(打造W3Cfuns-IE6PNG最强帖)

    原文地址:http://www.w3cfuns.com/thread-297-1-1.html 本文版权归W3Cfuns.com所有,转载需在文章页面明显位置以链接的方式给出原文链接,否则W3Cfun ...

  3. c语言编程之二叉树

    利用链表建立二叉树,完成前序遍历.中序遍历.后序遍历. 建立二叉树用的是前序遍历建立二叉树: #include<stdio.h> #include<stdlib.h> #inc ...

  4. oracle 条件:1=1或1=0,动态添加条件

    看到where语句中有条件:where 1=1    和    1=2或1<>1 用途:     1=1:是为了添加条件时使用and并列其他条件时使用的(动态连接后续条件)     比如: ...

  5. NYOJ-32 组合数 AC 分类: NYOJ 2014-01-02 22:21 112人阅读 评论(0) 收藏

    #include<stdio.h> int num[100]; int pnum(int n,int v); int mv=0; int main(){ int n,v; scanf(&q ...

  6. WebStorm 9 注册码

    UserName:William ===== LICENSE BEGIN ===== 45550-12042010 00001SzFN0n1bPII7FnAxnt0DDOPJA INauvJkeVJB ...

  7. pl/sql tutorial

    http://plsql-tutorial.com/plsql-procedures.htm What is PL/SQL? PL/SQL stands for Procedural Language ...

  8. PKU 1458 Common Subsequence(最长公共子序列,dp,简单)

    题目 同:ZJU 1733,HDU 1159 #include <stdio.h> #include <string.h> #include <algorithm> ...

  9. 乳草的入侵//BFS

    P1030 乳草的入侵 时间: 1000ms / 空间: 131072KiB / Java类名: Main 背景 USACO OCT09 6TH 描述 Farmer John一直努力让他的草地充满鲜美 ...

  10. cojs 火龙果 解题报告

    昨天晚上做了一发HNOI,感觉有很多新的idea 于是就选了一个出成题目辣 我们考虑暴力 暴力很明显是把这个图A<=D,B<=E的形态搞出来 之后处理相关的询问 这样我们会很容易得到正解: ...