Page 1 of 1

613 - Numbers That Count

Posted: Thu Aug 01, 2002 12:06 am
by Archangel
Any tricky input in this problem?? I got WA :( so many times...

Posted: Mon Sep 01, 2003 9:02 am
by Dominik Michniewski
I'm also getting WA several times ... I don't know what I'm doing wrong in this code (below). Could anyone tell me ? Or suggest some special cases which I missed ?

Best regards
DM

Code: Select all

spoiler - Acc with minor changes. I made a little bug when I was outputting results :-)

613 Wrong Answer :-(

Posted: Wed Jul 07, 2004 4:47 pm
by tobi
Hi,

I got WA multiple times and looked at my running time and it's very faster than the first in the rankings, so I guess, I've misunderstood this problem.

Could you please check the following testcases for me:

Code: Select all

777777777
97
1719
12345678901234567890123456789012345678901234567890123456789012345678901234567890
1
0
8999
11111111111111111111111111111111111111111111111111111111111111111111111111111111
801
-1

my result is:

Code: Select all

777777777 can not be classified after 15 iterations
97 enters an inventory loop of length 2
1719 enters an inventory loop of length 2
12345678901234567890123456789012345678901234567890123456789012345678901234567890 is self-inventorying after 4 steps
1 is self-inventorying after 12 steps
0 is self-inventorying after 10 steps
8999 can not be classified after 15 iterations
11111111111111111111111111111111111111111111111111111111111111111111111111111111 can not be classified after 15 iterations
801 enters an inventory loop of length 2
is there any tricky input / special case? is only number on a line?


Thanks,
Tobi

Posted: Fri Jul 09, 2004 11:23 pm
by tat tvam asi

Posted: Sat Jul 10, 2004 7:57 am
by tobi
thanks for your quick reply. I have the same output for your testcases.

But is the judge's test input format as yours? I didn't found in the problem assignment that there are multiple testcases the number of testcases in the first line and multiple occurrences of -1 in the testcases.

In other words: Do I have to take the first number of the test case as the first integer or as the number of testcases following?

Posted: Sat Jul 10, 2004 11:15 pm
by tat tvam asi
helo tobi!
this a multiple input problem, see
the explanation at the heading
of volumes.
have a nice life,
csaba

Posted: Sun Jul 11, 2004 12:22 pm
by tobi
Ups.
I'm sorry, I never read this header before and had much luck to choose only those problems with a red color :-)

Thank you, I got AC now!

613 - WA???

Posted: Sat Jul 01, 2006 11:07 am
by binusian0600618124
Is there any test case my code can't handle?
A little help plz.

Here's my code :

C:

#include<stdio.h>
#include<string.h>
int i,len,num[15],step;
char s[20][82];
void main(){
while(scanf("%s",&s[1])){
if(!strcmp(s[1],"-1")) break;
len=strlen(s[1]);
for(step=2;step<=16;step++){
memset(num,0,20);
for(i=0;i<len;i++) num[s[step-1]-48]++;
for(i=0,len=0;i<10;i++){
if(num){
if(num>9){
s[step][len++]=num/10+48;
s[step][len++]=num%10+48;
}
else s[step][len++]=num+48;
s[step][len++]=i+48;
}
}
s[step][len]=0;
for(i=step-1;i;i--){
if(!strcmp(s,s[step])){
if(step-i==1){
printf("%s is self-inventorying",s[1]);
if(step==2) printf("\n");
else printf(" after %i steps\n",step-2);
}
else printf("%s enters an inventory loop of length %i\n",s[1],step-i);
break;
}
}
if(i) break;
}
if(step==17) printf("%s can not be classified after 15 iterations\n",s[1]);
}
}

/* end of code */

thanx