I GOT THE ANSWER, MY CODE WAS CORRECT , JUST THE OUTPUT WAS TO BE SAVED IN A FILE B.OUT OR A.OUT BY THE CODE ITSELF. NOW, MY CODE IS ACCEPTED. THANKS FOR YOUR ANSWER.
On Sun, Apr 24, 2011 at 12:51 AM, Amahdy <[email protected]> wrote: > I don't think this is the problem as his code contains: > > printf("Case #%d: ",numbercount); >> > > I think the problem with the first item, is not preceded with "Case #1", > and the next test cases start with a wrong count, what I mean is that, your > output looks like: > > bla1 bla1 > Case #1: bla2 bla2 > Case #2: bla3 bla3 > > It should be: > > Case #1: bla1 bla1 > Case #2: bla2 bla2 > Case #3: bla3 bla3 > > But I'm not sure that this is the only problem, the code is a little bit > complicated and need many performance and adjustments... > > > > -- Amahdy AbdElAziz > http://www.linkedin.com/in/amahdyabdelaziz > > > > > On Sat, Apr 23, 2011 at 21:10, ayman bs <[email protected]> wrote: > >> it's giving error that output should start with case >> >> #1: , eventhough my output is giving case 1# >> >> >> I didn't look at code yet :-) >> >> >> >> On Sat, Apr 23, 2011 at 8:31 AM, chase <[email protected]> wrote: >> >>> sir, my code for the problem reverse string link :: >>> http://code.google.com/codejam/contest/dashboard?c=351101#s=p1 is >>> correct , it is giving correct output on my computer , but after >>> submitting this , it's giving error that output should start with case >>> #1: , eventhough my output is giving case 1#: my code is : >>> >>> >>> #include<stdio.h> >>> >>> #include<string.h> >>> >>> int main (int argc, const char * argv[]) { >>> int n,i,j,count,check=0,end=0; >>> int atlast,lastcheckpt,reverseprinting; >>> >>> scanf("%d",&n); >>> //fflush(stdin); >>> char a[n][25]; >>> for(i=0;i<n+1;i++) >>> { >>> gets(a[i]); >>> } >>> int numbercount=0; >>> for(i=0;i<n+1;i++) >>> { >>> if(numbercount!=0){ >>> printf("Case #%d: ",numbercount); >>> } >>> count=(strlen(a[i])); >>> >>> lastcheckpt=count; >>> for(j=count;j>-1;j--) >>> { >>> if(j==0){ >>> >>> for(atlast=0;atlast<lastcheckpt;atlast++) >>> { >>> printf("%c",a[i][atlast]); >>> >>> end=1; >>> >>> } >>> } >>> if(end==1){ >>> break; >>> } >>> >>> if(a[i][j]==' ') >>> { >>> >>> check=j; >>> >>> if(lastcheckpt==count) >>> { >>> >>> >>> for(reverseprinting=(check+1);reverseprinting<(lastcheckpt >>> +1);reverseprinting++) >>> { >>> >>> >>> printf("%c",a[i][reverseprinting]); >>> } >>> } >>> else >>> { >>> for(reverseprinting=(check >>> +1);reverseprinting<(lastcheckpt);reverseprinting++) >>> { >>> >>> printf("%c",a[i][reverseprinting]); >>> >>> } >>> } >>> >>> printf(" "); >>> >>> >>> lastcheckpt=check; >>> } >>> >>> } >>> end=0; >>> >>> >>> printf("\n"); >>> numbercount++; >>> >>> } >>> } >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "google-codejam" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/google-code?hl=en. >>> >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "google-codejam" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/google-code?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "google-codejam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
