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
hide comments
barishnamazov:
2017-10-25 21:48:13
Hmm, got AC finally...
|
|
aditya_rev:
2016-09-09 20:30:24
Difficult problem that need big numbers in c :( |
|
VilimL:
2016-01-18 09:34:33
How can it be done in C? What is the modulo? |
|
kiner_shah:
2015-10-03 19:02:08
Please correct me if my sequence is wrong!
|
|
REX:
2015-04-26 08:01:01
I did it in C |
|
REX:
2015-04-26 08:00:00
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 |
|
Hector Monteo:
2014-01-26 04:50:59
for n = 6
|
|
Mitch Schwartz:
2014-01-03 19:32:56
@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.
|
|
Pranjal Successena:
2014-01-03 15:29:15
this is an incomplete problem...
|
|
narek:
2013-11-10 15:27:23
Can I have a big test case
|
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 |