3394
Problem ID: 3394
The judge file contains invalid first line denoting the number of test cases. You should skip any nondigital characters in the very beggining of it. Here is the code example in C:
char buf[1024];
scanf( "%s", buf);
char *s = buf;
while( *s != '\0' && (*s < '0' || *s > '9') ) s++;
int t;
sscanf( s, "%d", &t);
while( t-- > 0 )
{
...
}
Also you should print "\r\n" instead of "\n" in the end of any output string to avoid PE.
char buf[1024];
scanf( "%s", buf);
char *s = buf;
while( *s != '\0' && (*s < '0' || *s > '9') ) s++;
int t;
sscanf( s, "%d", &t);
while( t-- > 0 )
{
...
}
Also you should print "\r\n" instead of "\n" in the end of any output string to avoid PE.