ungetc() is valid function for judges ... If I correct remember , I got Acc a few problems used this function
Best regards
DM
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)
diff y z
1,2c1,2
< XX-0000000000-XX is incorrect. <-- y
< XX000000XXX0000XXXXX is incorrect.
---
> XX-0000000000-XX is correct. <-- z
> XX000000XXX0000XXXXX is correct.
20c20
< 0-89237 -010 -6 is incorrect. <-- y
---
> 0-89237 -010 -6 is correct. <-- z
I believe mine is the more correct output, since an ISBN cannot start with 'X' .. and there cannot be spaces inside the ISBN number.
Hi
I get WA just now. . But i have a confusion in output format.
If a input has starting and trailing space what is the output.
Plz sent me correct output of following input.
pliz help me in getting ans to the following questions :--
1) what if there is illegal character inside a ISBN . will it count as a valid ISBN ?????
example :- 0abc-13dfasdfa-162959-X
0 -13-162959-X====> contains space inside the ISBN
2)what if there is an X in front of the ISBN .that means containing X in arbitary positions
rather than position 10 where it is counted as a valid character. will it count as a valid
ISBN ??????
XXXX-0-89237-010-6 ====> is it correct ??????
3)what will happen if an ISBN contains more than 10 digits . some thing like this
0-89237-010-6-----0-89237-010-6.though the first part of this is a valid ISBN(0-89237-010-6)
so will the complete line will be a valid ISBN(0-89237-010-6-----0-89237-010-6).
My algorithm for this prob is quiet simple :
1) read the input .
2)if it is a blank line output :incorrect
3)if it is not a blank line , than remove the leading and trailing blanks .
4)parse the digit from the string in to an integer array and when it contains X at the 10
position it is okay .
5)than by array operation calculate S1(partial sum)
6)than by array operation calculate S2(partial sum)
7)check wheither (s2[last-1] % 11 )==0 if yes output : correct
9)else output : incorrect ## i assumed no valid ISBN can contain illegal characters(space , tab , _ ,....) inside the
string.
## i also assumed X is only valid when it is on the 10 th position .in other case it is
counted as invalid
## when ever it contains more than 10 digit , i assumed it to be an invalid ISBN .
AM i right with my assumptions ?? pliz help me . i am getting Wa all the time .
i did not want to paste my clumpsy code here . if any one want to see my code . i can mail
him my code .
Bye
Riyad
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN
1. valid isbn may contain white space
2. it should be 10 digit ( X is counted as digit if there is any )
3. if there is any X it must be occurs once and in the tenth position
[/b]
i have tried all possible way to solve 333 . but after several submission i am continuously getting WA . i know the algorithm for this prob is not that complicated but for the difficult input set . so can any one help me in this , what i am missing and if have made any stupid mistake .
[cpp] [/cpp]
plizzzzzzzzzzz help me in this
Bye
Riyad
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN
the algorithm for the prob 333 as i mentioned before is not that complicated . but it has got a strict input set . i ll like to with draw this line ------->>>>>{{{{more over people tend to make it more complicated by saying their AC program has given an ISBN containing spaces in between as Correct ISBN}}}} . But as a matter of fact after getting AC i realized some thing about 333 which i am telling in this post .
some says inputs like
0-89237<space><space><space><space>-010-6 are right , there AC programs give the above input to be correct but my AC program give this input to be incorrect . as both of us r AC that means there is no such inputs containing spaces in between an isbn in the judge input data(But i am not that sure ) . But it definitely contains Empty lines as inputs . more over X is only valid when it is in the 10 th position of the isbn .
so the theme of my writing is after removing trailing and leading spaces and also inner Hypens the ISBN string should have the length of 10 . so no illegal character is allowed ............ i ll also love to with draw this line ------------>>>>>>>>>so dont get distracted by different type of posts .Best Regards...
Bye
riyad
HOLD ME NOW ,, I AM 6 FEET FROM THE EDGE AND I AM THINKIN.. MAY BE SIX FEET IS SO FAR DOWN
I've read in some of the posts that spaces between ISBN numbers ARE NOT tested but spaces before and after the ISBN are tested. I've read in some other posts that spaces between the ISBN number ARE tested and that spaces before and after then ISBN are also tested.
Could anyone clarify this for me????
My program does not check for spaces between the ISBN only after.
0-8104-5687-7 is correct.
0-8104-5687-7432 is incorrect.
This just for test. is incorrect.
0-1000-99999 is incorrect.
0-123-4567-89 is correct.
0-123-4567-890 is incorrect.
1-111-111-111 is correct.
0-89237-010-6 is correct.
0-89237-010-6 TEST is incorrect.
XX-0000000000-XX is correct.
XX000000XXX0000XXXXX is correct.
1234567890 is incorrect.
0823025713 is correct.
013152447X is correct.
013152447x is incorrect.
is incorrect.
082302571 is incorrect.
08230257130 is incorrect.
2803025713 is incorrect.
07632200X1 is incorrect.
0823025713 is correct.
0823025713 is correct.
0823025713 is correct.
0823025713 is correct.
0823025713 is correct.
082 3025713 is incorrect.
0823025 713 is incorrect.
--08-2----302--5713------ is correct.
082302_5713 is incorrect.
013152447X bla is incorrect.
013-A-152447X is incorrect.
0-1-3-1-5-2-4-4-7-X- - is incorrect.
01315 is incorrect.
2447X is incorrect.
01-10 is incorrect.
01-434435 is incorrect.
01 0111 is incorrect.
May anyone who has already got this problem solved make sure this output is correct? And also suggest other extreme cases? 'Cause i dont know what else to do.