← Back to topics
Topic

Z-Hundread

A
Asmirasmir
http://www.z-trening.com/new/www/html/submit.php?submit=7100047709&subm_code=1

I need some help with this one , it passes for the first 3 testcases , then next 7 get WR.

I can't find any logical faults , so i hope somebody can help me.
m
matteo123
can you tell us our idea
A
Asmirasmir
Well , I first read all the input as strings and eliminate duplicates.
After that I sort them by length (longer numbers are bigger then smaller ones).
After that I see what is the length of my solution and then I
put all strings of the solution length in one vector and sort them
(numbers with same lengths ordered alphabetical is the same as sorting them by value).
Then I just pick the solution and print it out.
m
matteo123
oh.that is a big code,but string is < or = 255 so you must use char because there can be 1000 digits
A
Asmirasmir
Ummm , no a string can hold up to 32k+ items (as far as i know or was it 65k)

EDIT: Tested it for 100 k and it works , so no problem with that.
A
Asmirasmir
Hmmm , dunno why i should try it (its not far away from C++ strings)
But how am i supposed to sort the vectors by length of the numbers and maps are not that good with char arrays either.
i
iggy91
What about negative numbers? :)
h
halil
5 3
21111111111
-333333
0
000022
22

edited by boba5551: Please, use English.
m
matteo123
post your code here and we will help you
A
Asmirasmir
OK , ill redo it a bit , i didn't take negative numbers in account. Ill also eliminate leading zeroes.
k
kinezizbosne
Can someone help me?
http://z-trening.com/submit.php?submit=7100340216&subm_code=1