Math Contest 2
math26
Nộp bàiPoint: 100
Calculate the sum of the first ~x~ positive integers.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3
10
Sample Output
6
55
Limits
~n\le50~
~x\le10^{10}~.
math27
Nộp bàiPoint: 100
Calculate the sum of numbers from ~a~ to ~b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3 6
10 13
Sample Output
18
46
Limits
~n\le50~
~a\le b\le10^{10}~.
math28
Nộp bàiPoint: 100
Calculate the sum of the first ~x~ odd numbers.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3
10
Sample Output
9
100
Limits
~n\le50~
~x\le10^{10}~.
math29
Nộp bàiPoint: 100
Calculate the sum of the first ~x~ numbers divisible by ~k~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~x,k~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3 2
10 5
Sample Output
12
275
Limits
~n\le50~
~x,k\le10^{10}~.
math30
Nộp bàiPoint: 100
Calculate the sum of the numbers divisible by ~k~ from index ~a~ to index ~b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b,k~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
1 3 2
1 10 5
Sample Output
12
275
Limits
~n\le50~
~a,b,k\le10^{10}~.
math31
Nộp bàiPoint: 100
Calculate ~x!~
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3
8
Sample Output
6
40320
Limits
~n\le50~
~x\le100~.
math32
Nộp bàiPoint: 100
Calculate ~x!!~
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3
8
Sample Output
3
384
Limits
~n\le50~
~x\le100~.
math33
Nộp bàiPoint: 100
Calculate ~a \land b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0 7
5 4
Sample Output
0
4
Limits
~n\le50~
~a,b\le10^{10}~.
math34
Nộp bàiPoint: 100
Calculate ~a \lor b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0 7
5 4
Sample Output
7
5
Limits
~n\le50~
~a,b\le10^{10}~.
math35
Nộp bàiPoint: 100
Calculate ~a \barwedge b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0 7
5 4
Sample Output
-1
-5
Limits
~n\le50~
~a,b\le10^{10}~.
math36
Nộp bàiPoint: 100
Calculate ~a \veebar b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0 7
5 4
Sample Output
7
1
Limits
~n\le50~
~a,b\le10^{10}~.
math37
Nộp bàiPoint: 100
Calculate ~a⊽b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0 7
5 4
Sample Output
-8
-6
Limits
~n\le50~
~a,b\le10^{10}~.
math38
Nộp bàiPoint: 100
Calculate ~\neg x~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0
5
Sample Output
-1
-6
Limits
~n\le50~
~x\le10^{10}~.
math39
Nộp bàiPoint: 100
Convert ~x~ to binary.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0
7
Sample Output
0
111
Limits
~n\le50~
~x\le10^{10}~.
math40
Nộp bàiPoint: 100
Convert ~x~ to octal.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0
70
Sample Output
0
106
Limits
~n\le50~
~x\le10^{10}~.
math41
Nộp bàiPoint: 100
Convert ~x~ to hex.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0
70
Sample Output
0
46
Limits
~n\le50~
~x\le10^{10}~.
math42
Nộp bàiPoint: 100
Convert ~x~ from base ~k~ to decimal.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~x, k~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
B 12
Z 36
Sample Output
11
35
Limits
~n\le50~
Length of ~x~ does not exceed ~100,k\le36~.
The number ~x~ contains the numbers from ~0~ to ~9~, and letters from ~A~ to ~Z~, depending on the base.
math43
Nộp bàiPoint: 100
Calculate the Euclidean distance between ~2~ points ~(a_x, a_y)~ and ~(b_x, b_y)~, rounded to ~2~ digits of precision.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b,c,d~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
0 0 3 0
0 9 0 6
Sample Output
3
3
Limits
~n\le50~
~a_x,a_y,b_x,b_y\le10^{10}~.
math44
Nộp bàiPoint: 100
Calculate the sum of the first ~x~ squares.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3
10
Sample Output
14
385
Limits
~n\le50~
~x\le10^{10}~.
math45
Nộp bàiPoint: 100
Calculate the sum of the first ~x~ cubes.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3
10
Sample Output
36
3025
Limits
~n\le50~
~x\le10^{10}~.
math46
Nộp bàiPoint: 100
Print the first ~x~ integers.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
3
10
Sample Output
1 2 3
1 2 3 4 5 6 7 8 9 10
Limits
~n\le50~
~x\le100~.
math47
Nộp bàiPoint: 100
Print the integers from ~a~ to ~b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
1 3
1 10
Sample Output
1 2 3
1 2 3 4 5 6 7 8 9 10
Limits
~n\le50~
~a\le b\le100~.
math48
Nộp bàiPoint: 100
Count the integers from ~a~ to ~b~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
1 3
1 10
Sample Output
3
10
Limits
~n\le50~
~a\le b\le10^{10}~.
math49
Nộp bàiPoint: 100
Count the integers from ~a~ to ~b~ divisible by ~k~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the numbers ~a,b,k~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
1 3 1
1 10 2
Sample Output
3
5
Limits
~n\le50~
~a\le b\le10^{10}~.
~k\le10^{10}~.
math50
Nộp bàiPoint: 100
Given a number ~x~. Print ~|x|~.
Input
The first line contains the number ~n~. The next ~n~ lines contain the number ~x~, separated by a space character.
Output
The answer of the problem.
Sample Input
2
98765
-5346258
Sample Output
98765
5346258
Limits
~n\le50~
~|x|\le10^{10}~.