## 10764 - Signed-digit numbers

Moderator: Board moderators

Tobbi
New poster
Posts: 17
Joined: Sat Jan 25, 2003 3:06 pm
Location: Europe

### 10764 - Signed-digit numbers

I think for some of the inputs ceil((b+1)/2)<=a doesn't hold, in contrary to the description! What to do in these cases??

...and which ASCII code did they use for the minus sign: ' or

shamim
A great helper
Posts: 498
Joined: Mon Dec 30, 2002 10:10 am
Location: Bozeman, Montana, USA
Tobbi, I did not pay any attention to the statement ceil((b+1)/2)<=a, maybe my solution automatically handles this.
The sign for minus is ' ASCII character 39.

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:
Could anybody take a look at my code and tell me where have I made mistake? To track the error I even wrote my own checker and tested this solution with 10^6 cases. I don't really know what else can I do
[cpp]code removed after AC[/cpp]
Last edited by Krzysztof Duleba on Wed Nov 17, 2004 8:42 pm, edited 1 time in total.

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:
I believe that OJ doesn't have special correction program for this problem in spite of what the statement says. I got AC after making negative numbers look like mirror reflection of positive numbers. So for input -7 10 7 one has to print '7 instead of '13.

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong
Could any one give more hints how to get AC, as there is no speical corrector program now?

I try to output the shortest representation that is lexicographically smallest(largest), but still gets WA

22/11/2004: Now the problem has a special judge program
Last edited by .. on Mon Nov 22, 2004 6:35 am, edited 1 time in total.
My signature:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:
Some random input:
568702605 8 5
181809913 8 7
-43502276 4 3
-10827519 4 3
1166594174 6 4
1056471731 3 2
1185769696 3 2
195079625 6 5
982246495 4 3
-818105050 4 3
415535071 8 7
767310120 5 4
-501393507 10 9
-388494487 10 9
-1106868526 9 8
456086653 7 4
73997770 3 2
408112314 2 1
949598026 6 5
184041939 6 5
415734585 8 7
559934143 7 5
-825242528 10 9
-1055283962 4 3
-38424139 7 6
-656450807 9 7
805210633 4 3
-182977654 8 6
1007091194 2 1
258101046 6 5
1228020985 3 2
998139911 10 9
-272204467 2 1
528495857 3 2
-1261559601 2 1
-932152829 5 3
-288610277 2 1
603352909 8 7
984418212 9 7
-176037128 6 4
0 5 4
0 0 0
Output:
42'11333215
1265431371
'2'2'1'1'3'30'2'2'30'10
'2'2'1'10'3'1'2'3'3'3'3
31143210'1'142
2201121221022202122
10001122020100020011
31205122225
322202332101133
'300'300'3'10'2'2'3'1'2'2
3061107737
3032412410440
'50'1'3'9'3'50'7
'3'8'8'4'9'4'4'8'7
'2'7'6'3'6'8'2'1'4'7
1421'1'2'20'2'11
12011020110212011
11000010100110100110010111010
234121103054
30132354003
3061715471
20'11'123503'1
'8'2'5'2'4'2'5'2'8
'3'3'2'3'2'1'2'1'1'2'2'3'3'2'2
'6'4'4'4'1'2'50'5
'1'6'2'2'20'4'21'5
233333220220021
'1'31'200'2'1'6'6
111100000001101111110111111010
41340000130
10011120201221002201
998139911
'1000000'1'1'100'1'100000'10'10'1'100'1'1
1100211110101000122
'100'10'1'100'1'1000'1'1'10'1'1'1'1'100'1'1000'1
'1110'2'1'1'311'2'3'11
'1000'100'1'100'1'1'1'10'10'1'1'1'1'1'100'10'1
4375467515
247732'1'123
'31'3110'30'4'1'2
0

rajsekar_manokaran
New poster
Posts: 9
Joined: Fri Feb 20, 2004 6:48 am
Location: India
Contact:

I checked my output with yours. It is the same
still i get WA.

As mentioned above, for negative numbers, i print a symmetric output (all digits same, only sign changed. I have also checked that 0 does not get printed as '0

could someone give me some advice

arif_pasha
New poster
Posts: 42
Joined: Fri Jun 13, 2003 3:47 pm
Contact:
my output also matches with yours. donno what to do now. can anybody help. at least give some hint......

Learning poster
Posts: 63
Joined: Mon Aug 29, 2005 8:13 am
Location: Tebriz
Contact:
I wrote a function which decodes my answer and compares it with the input number. In the case they are not the same, it makes a run-time error. But I still get WA What's wrong?

annhy
New poster
Posts: 40
Joined: Sun May 27, 2007 1:42 am
Location: Taiwan
My WA code becomes AC after I replace the int with long long int.

Hope this helps.