| UNICAMP Selection Contest 2023 |
|---|
| Закончено |
As a child, Techno heard a story about Gauss who was able to quickly calculate the sum of numbers from 1 to 100. Gauss' technique was to add 1 to 100, 2 to 99, 3 to 98, and so on until 50 to 51. Thus, the sum would be 101 times the number of pairs: 50.
Mini technoblade not impressed by Gauss idea, written in the white board above Everyone is always impressed by this story, except Techno. He decided to do something more impressive and find the sum of the first $$$n$$$ odd numbers: 1 + 3 + 5 ... + $$$2n-1$$$.
The input consists of a single integer $$$n$$$, $$$1 \leq n \leq 10^7$$$.
Print on a single line the integer representing the sum of the first $$$n$$$ odd numbers: $$$1 + 3 + 5 ... + (2n-1)$$$.
Note that this number does NOT fit in a 32-bit integer. In C/C++, use "long long int" for the answer and for $$$n$$$, or use Python.
1
1
2
4
3
9
10000000
100000000000000
For $$$n = 1$$$, the sum is just 1.
For $$$n = 2$$$, the sum is $$$1 + 3 = 4$$$.
For $$$n = 3$$$, the sum is $$$1 + 3 + 5 = 9$$$.
For $$$n = 4$$$, the sum is $$$1 + 3 + 5 + 7 = 16$$$. And so on.
| Название |
|---|


