GuoTime
limit:2000MS
Memory Limit:128000KB
64bit IO Format:%lld &%ll U SubmitStatusPracticeAcdream 1061
Description
Guo camels from, do not know what name. Disease Hunchback, Longin, there are class camels from, hometown person Camel. Camel smell, Yue: "Very good." Name me. "Because of its name, also self-predicate camels from cloud." Its township Yue Fengle Township, in Chang ' an west. Camel industry species tree, where Chang ' an Høvik for people to view and sell fruit, are competing for support. The tree of the camel, or the migration, all live, and Shuo Mao, the Flea of Tibet. Although he snooping the effect of MU, MO can also. Have asked, to Yue: "Camels from can make wood longevity and fruits also, in order to be able to shun the wood of the day, so that its sexual Yan er." Where the nature of wood planting, its desire to Shu, its Pei-ping, its soil, its desire to build dense. Since already, do not move not to worry about, go no longer. Its dill is also if the son, its place also if abandon, then its heaven is full, and its sex is. Therefore, I do not harm its long, not to be able to shuo and Mao's also. Not to suppress consumption in fact, not to have the flea and Tibet also. He is not the implant: the root fist and the Earth easy. The cultivation of the same, if not the case. Gou has can counter is, then love too yin, worry too diligent. Dan Vision and The Twilight Caress, have gone and re-care, the skin of the claw to test its birth, shaking its book to view its density, and the wood of the nature of the day away. Although Yue love, in fact, harm, although the sorrow, in fact, hold, so if I also, I can do for? ”
Legend has it that Guo camels from again planted trees, he along a straight road planted 3 tree a,b,c.
But forgetting ABC's left-to-right order, he only knows that B is x -Step (if x is negative, B is at the left-X step of a), and C is at y -Step (if y To be responsible for C at the left of a- y Step).
He wants to know how many steps BC is away (the answer must be positive and not 0).
Because he planted too many trees, he only knew |x|, |y| (Take absolute value, |1| = 1, |-2| = 2) ≤ 4611686018427387904
Input
The first line is the number of data groups T (t≤100000)
Two integers x, y ( -4611686018427387904≤x, y≤4611686018427387904) per group of data
Output
For each set of data output a positive number represents the distance between BC
Sample Input
21 24611686018427387904-4611686018427387904
Sample Output
1 9223372036854775808
1#include <stdio.h>2#include <algorithm>3 intT;4typedefLong Longll;5 ll x, y;6 7 intMain ()8 {9 //freopen ("A.txt", "R", stdin);Tenscanf ("%d", &T); One while(t--) { Ascanf ("%lld%lld", &x, &y); - if(X <y) std::swap (x, y); - if(Y <0 ) { they =-y; -printf ("%llu\n", (unsigned ll) x +y); - } - Elseprintf ("%llu\n", (unsigned ll) x-y); + } - return 0 ; +}View Code
Because there will be an answer more than a long long 1, so the flexible use of unsigned long long on the line.
Acdream. Guo (Mathematical derivation)