Submit | All submissions | Best solutions | Back to list |
TERMN - N-th Term |
Find the n-th term of the sequence 1, 4, 16, 36, 100, ...
Input
First Line : T (No. of test cases < 1000)
T Lines each containing a value of n (n < 100000)
Output
Exactly T lines each containing n-th term of the sequence.
Example
Input: 4
2
3
4
5
Output: 4
16
36
100
Added by: | Mukund Kumar |
Date: | 2013-08-30 |
Time limit: | 0.100s |
Source limit: | 300B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C CSHARP C++ 4.3.2 CPP C99 JAVA PYTHON PYTHON3 PY_NBC |
Resource: | Self |
hide comments
|
|||||
2017-10-25 21:48:13
Hmm, got AC finally... Don't forget to handle very big numbers like 10^100000 in 0.1TL... |
|||||
2016-09-09 20:30:24
Difficult problem that need big numbers in c :( |
|||||
2016-01-18 09:34:33 VilimL
How can it be done in C? What is the modulo? |
|||||
2015-10-03 19:02:08
Please correct me if my sequence is wrong! 1,4,16,36,100,400,1600,3600,10000,... |
|||||
2015-04-26 08:01:01 REX
I did it in C |
|||||
2015-04-26 08:00:00 REX
I got the series and my source code is only 19 lines long....still showing memory error, my code works fast till n=1000000 and yet memory error, memory limit of 300B is too much |
|||||
2014-01-26 04:50:59 Hector Monteo
for n = 6 ouput is 144 or 256? Last edit: 2014-01-26 04:51:09 |
|||||
2014-01-03 19:32:56 Mitch Schwartz
@Pranjal Successena: Your comment is unfortunately nonsense. Actually for these types of problems there are an infinite number of valid sequences with a "simple" formula when given the first n terms, for n arbitrary large. Just look up interpolating polynomial. And that's why it is in riddle section. There are a handful of somewhat similar problems that I consider "grandfathered in" and have been allowed to stay in classical or challenge (with some discussion): SUMUP, EASYPROB, EPROBLEM, HARDP, and maybe more that I don't know about or can't think of at the moment. Also, the 5th term is already given in both the problem statement and the example input/output. Last edit: 2014-01-03 21:08:36 |
|||||
2014-01-03 15:29:15 Pranjal Successena
this is an incomplete problem... this series can extend to 2 types.. u shud hav given 5th term also. pls be clear on your que Last edit: 2014-01-03 18:31:40 |
|||||
2013-11-10 15:27:23 narek
Can I have a big test case like the answer for 50000??? |