The **kth group of Odd numbers** contains exactly **k consecutive odd** numbers. Such as, 1st group of odd numbers contains only one number, 1; the 2nd group of odd numbers contains two numbers, 3 and 5 and so on. Similarly, the **kth group of Even numbers** contains exactly **k consecutive even** numbers. Such as, 1st group of even numbers contains only one number, 2; the 2nd group of even numbers contains two numbers, 4 and 6 and so on. It is guaranteed that, the numbers are consecutive so that **there is no number that stays in different two groups**. Now, you have the easiest task to do in your life. :-P Given the value of **k**, calculate the difference of the sum of **kth group of Even numbers** and **kth group of Odd numbers**. Input: ------ Inputs starts with **T** (**1 ≤ T ≤ 1000**), denoting the total number of testcases. Next each **T** lines there will be a number, **k** (**1 ≤ k ≤ 10^18**). Output: ------- Output the desired value as mentioned in the problem statement. Sample Input ------------ 1 4 Sample Output ------------- 4 Explanation: ------------- For k = 4, we have the even group, {14,16,18,20}, sum of them is, 14+16+18+20 = 68 and the odd group, {13,15,17,19}, sum of them is, 13+15+17+19 = 64. Now the difference is, 68-64 = 4. :)
Language | Time Limit (seconds) |
C | 1.00 |
C++ | 1.00 |
C++14 | 1.00 |
C# | 2.00 |
Go | 2.00 |
Java | 2.00 |
JavaScript | 2.00 |
Objective-C | 2.00 |
Perl | 2.00 |
PHP | 2.00 |
Python | 2.00 |
Python3 | 2.00 |
Ruby | 2.00 |
VB.Net | 2.00 |
Solve/Submission
# | User | Language | Timing |
---|---|---|---|
01 | Ahb_arif | Cpp14 | 0.00s |
02 | spectro30 | Cpp | 0.00s |
03 | duronto20 | Cpp | 0.00s |
04 | iamsadee | Cpp | 0.00s |
05 | Hasinur_ | Cpp | 0.00s |
06 | Fahim_41 | Cpp | 0.00s |
07 | Tamim028 | Cpp | 0.00s |
08 | shakil2021 | Cpp | 0.00s |
09 | rakib_cou | Cpp | 0.00s |
10 | Nuwaisir | Cpp | 0.00s |
11 | BrehamPie | C | 0.00s |
12 | factoradic | Cpp14 | 0.00s |
13 | Pure_Protea | Cpp14 | 0.00s |
14 | Datta | C | 0.00s |
15 | ssavi | Cpp | 0.00s |
16 | the_badcoder | Cpp | 0.00s |
17 | burhan103335 | Cpp | 0.00s |
18 | loop_breaker | Cpp | 0.00s |
19 | Old_kernel | Cpp14 | 0.00s |
20 | saiful130104 | Cpp | 0.00s |
21 | muhaimin | Cpp | 0.00s |
22 | m_arif | Cpp | 0.00s |
23 | rabel | Cpp | 0.00s |
24 | hamza133913 | Cpp | 0.00s |
25 | Robin008 | Cpp | 0.00s |
26 | mansura | C | 0.00s |
27 | mash02 | Cpp | 0.00s |
28 | Dalu | Cpp | 0.00s |
29 | Shakil_Mahmud | Cpp | 0.00s |
30 | kashem1993 | Cpp | 0.00s |
31 | monir_18 | Cpp | 0.00s |
32 | pencil | Cpp | 0.00s |
33 | mohibur | Cpp | 0.00s |
34 | Zayed | Cpp | 0.00s |
35 | Nahid_1710039 | C | 0.00s |
36 | asad_IT | Cpp | 0.00s |
37 | desh_chowdhury | Cpp | 0.00s |
38 | Chayti_Saha98 | Cpp | 0.00s |
39 | SakibAlamin | Cpp14 | 0.00s |
40 | Speechless | Cpp14 | 0.00s |
41 | ssatdd | Cpp | 0.00s |
42 | TarikulCSE | Cpp | 0.00s |
43 | syed_jafrul_husen | Cpp14 | 0.00s |
44 | fayedanik | Cpp | 0.00s |
45 | joynahiid | C | 0.00s |
46 | Ratul728 | Cpp | 0.00s |
47 | shahidullah_anik | Cpp | 0.00s |
48 | israkul9 | Cpp14 | 0.00s |
49 | 1604091 | Cpp | 0.00s |
50 | wajiul | Cpp | 0.00s |
Copyright © 2015-2016 Dev Skill.