Page 2 of 2

Posted: Mon Oct 08, 2007 10:25 pm
by saman_saadi
srrajesh wrote:
saman_saadi wrote: At last I found your bug! yes in my machine your program for 01:20 output 02:22 as Robert Gerbicz's machine. The problem is in isPal function. You forgot add '\0' in str so after str[3] = s[4]; you must add str[4] = '\0'; and you will get AC. Please after getting AC remove your code
Thanks a million, for that!
Now I got AC!
I really feel embarrassing abt what I had done!!! :-?

Just curious to know, what is ur machine type, OS and compiler?
My IDE is Code::Blocks and my default compiler is gcc and my OS is Windows XP but your bug doesn't depend on operating system or compiler:
It is important to preserve the NULL terminating character as it is how C defines and manages variable length strings. All the C standard library functions require this for successful operation
for more information you can try http://www.cs.cf.ac.uk/Dave/C/node19.html. So your code mabye work correctly or not

Posted: Mon Oct 08, 2007 10:31 pm
by baodog
To saman_saadi,
You ask for code removing, but
you also have to remove the code from your "quote" on page one as well.
It's not automatically changed (not dynamically linked).

WA: 11309 - Counting Chaos

Posted: Wed Dec 18, 2013 11:12 pm
by reza_cse08
Why I got wrong answeer. please help anyone
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<cstdio>

using namespace std;

int main ()
{
int i, j, t, x, m, n, a[10]={0};
cin>>t;
while(t--)
{
scanf("%d:%d",&m,&n);
x = 100*m+n;
while(1)
{
x++;
if(x%100==60)
{
x +=40;
}
if(x==2400)
{
x = 0;
}
int tt = x;
i = 1;
while(tt!=0)
{
a[i++] = tt%10;
tt = tt/10;
}
for(j =1; j<=((i-1)/2);j++)
{
if(a[j]==a[i-j])
{
continue;
}
else
{
break;
}
}
if(j==((i+1)/2))
{
break;
}
}
cout<<a[4]<<a[3]<<":"<<a[2]<<a[1]<<endl;

memset(a,0,sizeof(a));
}
return 0;
}

Re: 11309 - Counting Chaos

Posted: Thu Dec 19, 2013 1:47 am
by brianfry713
Try the I/O in this thread.