927 - Integer Sequences from Addition of Terms

All about problems in Volume 9. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
donte
New poster
Posts: 1
Joined: Tue Jun 12, 2007 3:13 pm
Location: Brazil

927 - Integer Sequences from Addition of Terms

Post by donte »

:( .. I don't understand the question 927.... how find 'n'... Somebody can help me???????
Thanks!!!!!!!!
Pregunt
New poster
Posts: 7
Joined: Thu Jun 16, 2005 8:17 am
Location: M
Contact:

Post by Pregunt »

Donte:

If an=n^2, and d=3 then the first terms of bm are:
1, 1, 1, 4, 4, 4, 4, 4, 4, 9, 9, 9, 9, 9, 9, 9, 9 , 9, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 25, 25, ...

For k=1 you have to print 1.
For k=2 you have to print 1.
For k=3 you have to print 1.
For k=4 you have to print 4.
For k=9 you have to print 4.
For k=10 you have to print 9.
For k=23 you have to give 16.
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 927 - Integer Sequences from Addition of Terms

Post by uDebug »

Here's some input / output I found useful during testing / debugging.

Please note that these were taken directly from
http://saicheems.wordpress.com/2013/07/ ... -of-terms/
and all credit goes to this person.

Input:

Code: Select all

12
4 3 0 0 0 23
25
100
1 0 1
1
6
3 0 1 5 7
7
43
3 0 1 5 7
7
1
3 0 1 5 7
7
16
3 0 1 5 7
7
42
3 0 1 5 7
7
7
3 0 1 5 7
7
1000000
5 1 1 1 1 1 1
1
1000000
20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
100000
1000000
1 1 1
2
1000000
20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1
21
AC Output:

Code: Select all

1866
3
532
13
78
237
13
1073344285
5656584705361395
1466015503701
1001
3656158440062976
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.
Shahidul.CSE
Experienced poster
Posts: 148
Joined: Sun Jul 13, 2014 4:32 am
Location: Rangpur, Bangladesh

Re: 927 - Integer Sequences from Addition of Terms

Post by Shahidul.CSE »

v1n1t, can you please explain some of your given input output? I didn't understand the input and output.

for example, how the output is 1866 for the following input ?
4 3 0 0 0 23
25
100

I think the proble statement is not clear enough. It should be modified !
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
KiBurst
New poster
Posts: 2
Joined: Sat Oct 03, 2015 1:52 pm

Re: 927 - Integer Sequences from Addition of Terms

Post by KiBurst »

I'll attempt to explain the problem clearer as the given explanation was very confusing and it took me a long time to understand.

If d = 1 then the sequence is
1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, .....
with each successive integer having one additional term.

Similarly if d = 2 then the sequence is
1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, .....
Given the original sequence the number of terms for each integer is multiplied by d. To find the kth term of this sequence simply count to that many terms. For example k = 5 results in 2 in the above sequence, as the 5th term is a 2.

Now for that part that I found to be explained poorly. The first line of each case describes a polynomial that you substitute the kth term into. However the first number in this line is not part of the polynomial, instead it describes the highest power in the polynomial.

For example, in the sample input line '4 3 0 0 0 23', the 4 means that the polynomial goes up to x^4. The following numbers then describe the polynomial in increasing powers.
In the given example, the polynomial is:
3(x^0) + 0(x^1) + 0(x^2) + 0(x^3) + 23(x^4)
The x value represents the previously found kth term. So if the kth term was found to be 3, as it is in the first sample input, you would evaluate the polynomial to
3(3^0) + 0(3^1) + 0(3^2) + 0(3^3) + 23(3^4) = 1866, the correct sample output.

Hope this clears the question up for people.
Post Reply

Return to “Volume 9 (900-999)”