613 - Numbers That Count

All about problems in Volume 6. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
Archangel
New poster
Posts: 29
Joined: Wed Jun 26, 2002 9:00 am

613 - Numbers That Count

Post by Archangel » Thu Aug 01, 2002 12:06 am

Any tricky input in this problem?? I got WA :( so many times...

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Mon Sep 01, 2003 9:02 am

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 :-)
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)

tobi
New poster
Posts: 3
Joined: Wed Jul 07, 2004 4:31 pm
Location: Erlangen, Germany

613 Wrong Answer :-(

Post by tobi » Wed Jul 07, 2004 4:47 pm

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

tat tvam asi
New poster
Posts: 30
Joined: Sat Nov 30, 2002 1:04 pm

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

Last edited by tat tvam asi on Mon Oct 18, 2004 7:04 pm, edited 1 time in total.

tobi
New poster
Posts: 3
Joined: Wed Jul 07, 2004 4:31 pm
Location: Erlangen, Germany

Post by tobi » Sat Jul 10, 2004 7:57 am

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?

tat tvam asi
New poster
Posts: 30
Joined: Sat Nov 30, 2002 1:04 pm

Post by tat tvam asi » Sat Jul 10, 2004 11:15 pm

helo tobi!
this a multiple input problem, see
the explanation at the heading
of volumes.
have a nice life,
csaba

tobi
New poster
Posts: 3
Joined: Wed Jul 07, 2004 4:31 pm
Location: Erlangen, Germany

Post by tobi » Sun Jul 11, 2004 12:22 pm

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!

binusian0600618124
New poster
Posts: 2
Joined: Fri Jun 30, 2006 4:22 pm

613 - WA???

Post by binusian0600618124 » Sat Jul 01, 2006 11:07 am

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

Post Reply

Return to “Volume 6 (600-699)”