Page 1 of 2

10953 - Stochastic Digit Generator

Posted: Sun Oct 30, 2005 2:28 am
by tywok
During the contest i spend 4 hours with this problem. I had a little error in the mod calculating part, but the funny thing is, that after i corrected, i still got WA. My last minute attemp was to change all the variables from long double to double. Curiously, i got accepted. Afterwards i checked if you just had to change the variables, and in the OJ i got WA with long double again when my code with double got AC. Should there be a little rejudging? I think it is unfair, since my results should theoretically be more precise!

If anyone wants my code, i can submit it via email

Reply

Posted: Sun Oct 30, 2005 2:40 am
by waelsamy
Would u send me ur code plz

waelsamy@gmail.com

Posted: Sun Oct 30, 2005 3:05 am
by zhang
Maybe I want to ur code,can you send it to zhangfan555@tom.com.
Thanks.
If anyone wants my code, i can submit it via email

Posted: Sun Oct 30, 2005 3:53 am
by tywok
i mean, ill send it for viewing this issue, not for helping others to get WA. If you need help on this problem, ask for it and i will answer!

hmm

Posted: Sun Oct 30, 2005 5:15 am
by shahriar_manzoor
This problem had a special judge but may be it was not used by mistake.

Posted: Sun Oct 30, 2005 10:30 am
by zhang
How to solve this problem , I use brute search ,and get TLE.

Posted: Sun Oct 30, 2005 12:12 pm
by Rostislav
I had the same problem during the contest.
If i use long double -> WA
but if it is only double -> AC.
And for me this is very strange.

Rostislav

Posted: Sun Oct 30, 2005 1:54 pm
by zhang
Could you tell me how to sovle this problem?
I get TLE.

Posted: Sun Oct 30, 2005 2:13 pm
by tywok
You have to use DP. Think about how you can use it! :wink:

Posted: Sat Nov 05, 2005 12:11 am
by Larry
I thought this was trivial DP, but maybe my precision is off somewhere.. I've tried double and long double but neither worked.. does anyone have any test cases? =)

Posted: Sat Nov 05, 2005 2:42 am
by Krzysztof Duleba
This problem is easy, but it's also easy to make some silly mistakes (it took me over 30 minutes to figure all signs out, like when to add and when to subtract). I have AC with doubles, but not with long doubles. Some small cases:

Code: Select all

10
0 0.1
1 0.9
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
9
* 0
* 1
*0 10
*0 0
*4 7
*1 0
*** 1
*** 0
************************************************** 0
0
Output:

Code: Select all

Case 1:
0.10000000
0.90000000
0.90000000
0.10000000
0.00000000
0.90000000
0.74700000
0.16300000
0.19087903

Posted: Sat Nov 05, 2005 9:58 am
by Sanny
Krzysztof Duleba wrote:it took me over 30 minutes to figure all signs out, like when to add and when to subtract
Why do you need to subtract?

Posted: Sat Nov 05, 2005 11:15 am
by Krzysztof Duleba
Modulo. Some digit positions contribute with negative signs towards the sum modulo 11, and some with positive. It would be much easier if I reversed the pattern first, but I was stubborn and parsed it from left to right :-)

Posted: Sat Nov 05, 2005 11:37 am
by Larry
Well, you can use the other way of checking of a number is divisible by 11... though you can easily just DP the other way.

In any case, my output matches yours.. so maybe it's a harder case somewhere.. =/

Posted: Sat Nov 05, 2005 11:39 am
by Larry
Nevermind, I've been making tons of silly mistakes lately.. if anyone's curious, my mistake was I had a < instead of <= in a loop somewhere.. sigh.