Re: [algogeeks] Stone Game

2011-10-13 Thread Gaurav Kumar
I don't see this code considers the case when after throwing i stones, the pile is still left with (Si-i) stones. For example, let say pile 10 had 25 stones, now even after throwing 10 stones, pile 25 would be left with 15 stones, which could again be thrown by the next person. Am I missing

Re: [algogeeks] Stone Game

2011-10-13 Thread Gaurav Kumar
Note that the problem says that the pile has AT LEAST i stones not exactly i stones. So it can for sure have more than i. On Thu, Oct 13, 2011 at 4:50 PM, Gaurav Kumar gkuma...@gmail.com wrote: I don't see this code considers the case when after throwing i stones, the pile is still left with

[algogeeks] Stone Game

2011-10-12 Thread Wladimir Tavares
In the problem Stone Game http://www.spoj.pl/problems/RESN04/ , I did the following algorithm that was accepted by spoj: #includestdio.h int main(){ int n,t,i,j,cont; scanf(%d,t); while(t--){ scanf(%d,n); cont=0; for(i=1;i=n;i++) { scanf(%d,j); if(j=i){

Re: [algogeeks] Stone Game

2011-10-12 Thread Hatta
being accepted doesn't imply in being correct maybe I'm wrong but given this Test Case I think BOB wins: 3 1 3 2 didn't he (bob!)? On Wed, Oct 12, 2011 at 6:53 PM, Wladimir Tavares wladimir...@gmail.com wrote: In the problem Stone Game , I did the following algorithm that was accepted by

Re: [algogeeks] Stone Game

2011-10-12 Thread sunny agrawal
your solution seems to be the right one... testcases may be faulty try submitting here http://www.codechef.com/problems/RESN04/ both the codes On Thu, Oct 13, 2011 at 5:44 AM, Hatta tmd...@gmail.com wrote: being accepted doesn't imply in being correct maybe I'm wrong but given this Test Case