Programming Challege
+2
angelie
scirtem
6 posters
Page 1 of 1
Programming Challege
Warm-up problem
Try it yourselves without the help of Larry Page and Sergey Brin!!!
Do not post your solution here...
PM me your solution!!!
----------------------------------------------------------------------------
Jolly Jumpers
A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. For instance,
1 4 2 3
is a jolly jumper, because the absolutes differences are 3, 2, and 1 respectively. The definition implies that any sequence of a single integer is a jolly jumper. You are to write a program to determine whether or not each of a number of sequences is a jolly jumper.
Input
Each line of input contains an integer n <= 3000 followed by n integers representing the sequence.
Output
For each line of input, generate a line of output saying "Jolly" or "Not jolly".
Sample Input
4 1 4 2 3
5 1 4 2 -1 6
Sample Output
Jolly
Not jolly
Try it yourselves without the help of Larry Page and Sergey Brin!!!
Do not post your solution here...
PM me your solution!!!
----------------------------------------------------------------------------
Jolly Jumpers
A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. For instance,
1 4 2 3
is a jolly jumper, because the absolutes differences are 3, 2, and 1 respectively. The definition implies that any sequence of a single integer is a jolly jumper. You are to write a program to determine whether or not each of a number of sequences is a jolly jumper.
Input
Each line of input contains an integer n <= 3000 followed by n integers representing the sequence.
Output
For each line of input, generate a line of output saying "Jolly" or "Not jolly".
Sample Input
4 1 4 2 3
5 1 4 2 -1 6
Sample Output
Jolly
Not jolly
scirtem- Level 0
- Posts : 4
Reputation : 0
Join date : 2010-07-08
Age : 42
Re: Programming Challege
Each line of input contains an integer n <= 3000 followed by n integers representing the sequence.
waaaa. hindi ko maintindihan. T_T ibig sabihin may array[3000] ?
basag ang comprehension ko dito T_T
Last edited by arscariosus on Wed Jul 21, 2010 11:35 pm; edited 3 times in total
arscariosus- Level 0
- Posts : 69
Reputation : -1
Join date : 2010-07-07
Age : 22
Location : Philippines
Re: Programming Challege
imba! kahirap nmn nyan.
paulgarcia- Level 0
- Posts : 2
Reputation : 0
Join date : 2010-07-21
Re: Programming Challege
pang CS kc....^^
paulgarcia- Level 0
- Posts : 2
Reputation : 0
Join date : 2010-07-21
Re: Programming Challege
Whether your BSCS or not, trying to solve this will increase your logic thinking.paulgarcia wrote:pang CS kc....^^
Remember, almost all computer related courses are basically full of logic...
Chyrl- Level 0
- Posts : 16
Reputation : 0
Join date : 2010-07-12
Re: Programming Challege
arscariosus wrote:Each line of input contains an integer n <= 3000 followed by n integers representing the sequence.
waaaa. hindi ko maintindihan. T_T ibig sabihin may array[3000] ?
basag ang comprehension ko dito T_T
Try reading between the lines.
I might help you understand what is meant by n <= 3000.
Chyrl- Level 0
- Posts : 16
Reputation : 0
Join date : 2010-07-12
Re: Programming Challege
david signature mo..XD
rmsalazar- Level 1
- Posts : 129
Reputation : 2
Join date : 2010-07-06
Age : 32
Re: Programming Challege
Chyrl wrote:arscariosus wrote:Each line of input contains an integer n <= 3000 followed by n integers representing the sequence.
waaaa. hindi ko maintindihan. T_T ibig sabihin may array[3000] ?
basag ang comprehension ko dito T_T
Try reading between the lines.
I might help you understand what is meant by n <= 3000.
Sir I think I get the first part about the absolute differences and the 1..n-1 range. But I might be wrong. Plus I can't comprehend this line. Hmm... Each line of input... Does that mean the program could accept multiple lines of input at a time? And a line that has a single integer in it is automatically a jolly jumper?
arscariosus- Level 0
- Posts : 69
Reputation : -1
Join date : 2010-07-07
Age : 22
Location : Philippines
Re: Programming Challege
Maybe, it depends on the logic of your code.arscariosus wrote:Does that mean the program could accept multiple lines of input at a time?
Have you acquired to right output[n] for the given input[n], where n is the number of test cases?
Chyrl- Level 0
- Posts : 16
Reputation : 0
Join date : 2010-07-12
Similar topics
» C programming language
» Android Programming
» Guide to Network Programming
» Eye Buggin' Programming Competition Soon!
» C Programming Tutorial (KR version 4), M. Burgess
» Android Programming
» Guide to Network Programming
» Eye Buggin' Programming Competition Soon!
» C Programming Tutorial (KR version 4), M. Burgess
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Thu Jul 18, 2013 8:11 pm by shevsoe
» SPICE (Cobol IDE)
Mon May 06, 2013 5:36 pm by 200730059
» YMCA and Global Services
Thu Sep 01, 2011 2:35 pm by Rene Churchill
» useDelimeter
Thu Jun 23, 2011 11:02 am by ern_andrew
» The City of Cochin
Thu Jun 16, 2011 7:31 pm by GhosnBachelder
» LIFE and LOVE GURU
Sat Oct 09, 2010 1:42 am by kggc09
» Interested to be an Adhoc?
Fri Oct 08, 2010 2:47 pm by rmsalazar
» Meeting! Officers + Members (Open Meeting)
Fri Oct 08, 2010 2:45 pm by rmsalazar
» Indescribable - Louis Giglio
Thu Oct 07, 2010 12:03 am by rmsalazar