## 333 - Recognizing Good ISBNs

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

Moderator: Board moderators

kbr_iut
Experienced poster
Posts: 103
Joined: Tue Mar 25, 2008 11:00 pm
Location: IUT-OIC, DHAKA, BANGLADESH
Contact:

### Wa, 333 - Recognizing Good ISBNs - Need more In/Output sampl

I am a stupid......today,,,i tried again this problem.within 15 minit.I solved and got AC........my previous code was very poor.....and I misunderstood the problem..For thos who are getting WA.
1. X appers only in the 10 th position.other wise it is invalid...10 th X is =10,,,others X is same to garbage and deal like other garbage character.
2.remove the initial and trailing spaces and tabs to printf the actuall string.
3.start finding sum1 and sum2 from the first occurance of a digit.
4.after scanning, if any garbage character is found before the number of valid digit is 10,,,the isbn is invalid.
5.and finally checkout if sum2 is of % 11 or not.

here are the things..if i mistake something ,let me know...
if anyone yet getting WA....contack with me,.....I will send him my source code.
kbr_iut@iut-dhaka.edu
Last edited by kbr_iut on Thu Jul 10, 2008 4:51 am, edited 3 times in total.
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Contact:

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

Try the cases...

Input:

Code: Select all

``````0-1-3-1-6-2-9-5-9-X
013152447X
``````
Output:

Code: Select all

``````0-1-3-1-6-2-9-5-9-X is correct.
013152447X is correct.``````
Hope these help.
Ami ekhono shopno dekhi...
HomePage

kbr_iut
Experienced poster
Posts: 103
Joined: Tue Mar 25, 2008 11:00 pm
Location: IUT-OIC, DHAKA, BANGLADESH
Contact:

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

recoded and got AC
Last edited by kbr_iut on Mon Sep 29, 2008 12:58 am, edited 1 time in total.
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Contact:

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

Try the cases.

Input:

Code: Select all

``````0-89237-010- 6 TEST
<S><S><T><S>0823025713<T><T><S>``````
Output:

Code: Select all

``````0-89237-010- 6 TEST is correct.
<S><S><T><S>0823025713<T><T><S> is correct.``````
Ami ekhono shopno dekhi...
HomePage

kbr_iut
Experienced poster
Posts: 103
Joined: Tue Mar 25, 2008 11:00 pm
Location: IUT-OIC, DHAKA, BANGLADESH
Contact:

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

Got AC.
Last edited by kbr_iut on Mon Sep 29, 2008 12:55 am, edited 1 time in total.
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

Dear Jan Vi,
You gave I/O for,

INPUT :

Code: Select all

``````0-89237-010- 6 TEST
<S><S><T><S>0823025713<T><T><S>``````
OUTPUT :

Code: Select all

``````0-89237-010- 6 TEST is correct.
<S><S><T><S>0823025713<T><T><S> is correct.``````
I also agree with this.
But one thing I don't understand, I find different result in here for this I/O :
http://www.uvatoolkit.com/problemssolve.php
And for this output once I became a sufferer.
Can you please explain ?

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Contact:

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

May be there are no such cases.
Ami ekhono shopno dekhi...
HomePage

mukit
New poster
Posts: 48
Joined: Wed Nov 21, 2007 10:09 am
Location: Dhaka , Bangladesh
Contact:

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

But if there are no such cases then it would have show the message "No output!" with the cross sign.
Besides, I ignored this case and got wrong answer ! So there must be such input.

Am I making any wrong ??? I think I must . . .

kbr_iut
Experienced poster
Posts: 103
Joined: Tue Mar 25, 2008 11:00 pm
Location: IUT-OIC, DHAKA, BANGLADESH
Contact:

### Re: 333 - Recognizing Good ISBNs my AC code gives another...

but for the above input my AC code gives different output.
output

Code: Select all

``````0-89237-010- 6 TEST is incorrect.
<S><S><T><S>0823025713<T><T><S> is correct.

``````
but uvatoolkit gives this output

Code: Select all

``````0-89237-010- 6 TEST is incorrect.
<S><S><T><S>0823025713<T><T><S> is incorrect.
``````
actually why this is happening? can anyone tell? (of course there is not such test case...)
It is tough to become a good programmer.
It is more tough to become a good person.
I am trying both...............................

x140l31
Learning poster
Posts: 69
Joined: Tue Jan 30, 2007 12:51 am

### Re: 333 - Recognizing Good ISBNs - Need more In/Output samples

I will explain the problem because there's too many confusions:

Sorry about my poor English.

1.- A valid ISBN can't be separated by spaces.
The input data for this problem will contain one candidate ISBN per line of input, perhaps preceded and/or followed by additional spaces.
it only says that the input have spaces "before" and "after" the ISBN candidate.

2.- A valid ISBN can ONLY have hyphens, digits and X for the LAST digit (hyphens can appears at anywhere, include at before any digit and after any digit). If it has any other character (include space) it's an invalid ISBN.
No line will contain more than 80 characters, but the candidate ISBN may contain illegal characters, and more or fewer than the required 10 digits. Valid ISBNs may include hyphens at arbitrary locations. The end of file marks the end of the input data.
the candidate may contain ILLEGAL characters, not a valid ISBN, and if it's an illegal character it's not valid!! (illegal can't be the same as "garbage")

Obviously my AC code follow this rules, if any other AC code doesn't follow the same rules it's because the judge doesn't contemplate this cases...

Experienced poster
Posts: 136
Joined: Sat Nov 29, 2008 8:01 am
Contact:

### 333 - Recognizing Good ISBN- Need more In/Output samples

Can someone give me some critical i/o.
what is the output for
[blank]
(space)is incorrect. or
is incorrect.
and what will be answer of
0-89237-010- 6 TEST
<S><S><T><S>0823025713<T><T><S>
correct or incorrect???
Life is more complicated than algorithm.
http://felix-halim.net/uva/hunting.php?id=32359

calicratis19
Learning poster
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Contact:

### Re: 333 - Recognizing Good ISBNs

0-89237-010-6 test
0-89237-010-6 TEST

output:
correct
incorrect
this are the output frm http://www.uvatoolkit.com/problemssolve.php

but i dont understand why?? problem statement dont say that case matters or this kind of input(with alphabet except X as 10th number) can be correct. from previous thread someone's AC out put for this input
0-89237-010-6 TEST
output:
correct

so i think a valid isbn only can contain hipen ,digits and can have X as 10th number. am i wrong.
im so confused..
Heal The World

calicratis19
Learning poster
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am
Contact:

### Re: 333 - Recognizing Good ISBNs - i was right

just got AC. i was right abt the validity of isbn.
so i think a valid isbn only can contain hipen ,digits and can have X as 10th number
and there is no alpahabet in the input set i think. because it gives different output in different AC codes for alphabet.
i gave output incorrect if any alphabet is found.
Heal The World

x140l31
Learning poster
Posts: 69
Joined: Tue Jan 30, 2007 12:51 am

### Re: 333 - Recognizing Good ISBNs

calicratis19 wrote:0-89237-010-6 test
0-89237-010-6 TEST

output:
correct
incorrect
this are the output frm http://www.uvatoolkit.com/problemssolve.php

but i dont understand why?? problem statement dont say that case matters or this kind of input(with alphabet except X as 10th number) can be correct. from previous thread someone's AC out put for this input
0-89237-010-6 TEST
output:
correct

so i think a valid isbn only can contain hipen ,digits and can have X as 10th number. am i wrong.
im so confused..
My AC code says "incorrect" for this two inputs

calicratis19
Learning poster
Posts: 76
Joined: Mon Jul 21, 2008 8:50 am