UVa 913
From Algorithmist
[edit] 913 - Joana and the Odd Numbers
[edit] Summary
The only problem here is to calculate the last number of the n-th line. Bruteforce won´t do it, so we need a little thinking :-)
[edit] Explanation
First you can calculate the number of numbers per line.
That is
Now you know how many numbers you have in one line. To get the last number of the n-th line, you need to know how many numbers there were before that line + the number of numbers in that line.
So you can simply sum that up
The last number of the n-th is then:
Now you can simply calculte the sum:
Note: You need to use long long int to do the calculations

