Sum It Up 1

Discuss about the puzzles, but without giving the solutions please !!!

Sum It Up 1

Postby admin » Wed Jan 05, 2011 8:49 am

Given a number N, find the number of ways to write it as a sum of two or more consecutive positive integers, e.g. 15 = 7+8, 1+2+3+4+5, 4+5+6. The answer should be 3.




Last edited by admin on Wed Jan 05, 2011 8:49 am, edited 1 time in total.
Reason: Edit
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Sum It Up 1

Postby Haryanto » Tue Jan 25, 2011 8:05 pm

Just want to make sure.

I submit my code, but it comes up with error with error cpu_exceeded.
So I changed my algorithm , but still come up with the same error.

Thing I take attention in this case is it is always error cpu_execeeded with the same cpu_time, although I changed my algorithm and when I try to retrieve my code in the source code editor, all of my submitted code is the old code(not the new one), although when I try to retrieve my code in the submission board, it is the new code.

My question is, is this an error from the server, so every time i try to submit the code, it only reads the first code I submit, or it is an error from my code?(Which mean I have to reconstruct again the code)

Thanks for the attention.
User avatar
Haryanto
 
Posts: 2
Joined: Tue Jan 25, 2011 4:59 am

Re: Sum It Up 1

Postby admin » Tue Jan 25, 2011 8:35 pm

The robot tries to stop the submission at 0.1 second after it exceeds the limit. That's why if the cpu limit is 3 second, every submission that exceeds that limits should show 3.1s execution (however sometimes it runs a bit longer if the robot cannot intercept but that varies depending on the languages).

I looked at your solutions, they seem different. When you select the drop-down menu "Load submission" you should have the choice to pick which one of your older submissions you want to load. I just tested it and it worked as expected.
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Sum It Up 1

Postby psckyky » Tue Mar 22, 2011 4:34 pm

how many inputs and what is the largest input?
User avatar
psckyky
 
Posts: 4
Joined: Sun Feb 06, 2011 9:36 pm

Re: Sum It Up 1

Postby browni3141 » Fri Nov 11, 2011 11:23 am

Unless I am mistaken, it seems that your example is wrong, there is another series for 15:
15 = -6+-5+-4+-3+-2+-1+0+1+2+3+4+5+6+7+8
This sequence fits your definition, "sum of two or more consecutive integers", perfectly.
If we can't use negative integers, then the problem statement should reflect that.
User avatar
browni3141
 
Posts: 19
Joined: Mon Jan 31, 2011 11:05 am

Re: Sum It Up 1

Postby admin » Fri Nov 11, 2011 12:05 pm

Ok, we fixed the description: it's positive integer only.
User avatar
admin
Site Admin
 
Posts: 333
Joined: Thu Dec 23, 2010 1:27 am

Re: Sum It Up 1

Postby Alexey Solodovnikov » Wed May 16, 2012 5:07 am

Just the interesting test case - the digit 9000000000000001. The output should be 7, it takes about 15 ms for the c solution :)
User avatar
Alexey Solodovnikov
 
Posts: 32
Joined: Sun Jun 26, 2011 5:54 am


Return to Puzzles

Who is online

Users browsing this forum: No registered users and 1 guest

cron