Task: | Onnenluku |
Sender: | |
Submission time: | 2015-09-12 18:14:25 +0300 |
Language: | Haskell |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.06 s | 1 | details |
#2 | ACCEPTED | 0.05 s | 1 | details |
#3 | WRONG ANSWER | 0.05 s | 1 | details |
#4 | WRONG ANSWER | 0.06 s | 1 | details |
#5 | WRONG ANSWER | 0.05 s | 1 | details |
#6 | WRONG ANSWER | 0.06 s | 2 | details |
#7 | ACCEPTED | 0.05 s | 2 | details |
#8 | ACCEPTED | 0.05 s | 2 | details |
#9 | ACCEPTED | 0.05 s | 2 | details |
#10 | WRONG ANSWER | 0.05 s | 2 | details |
#11 | WRONG ANSWER | 0.05 s | 3 | details |
#12 | WRONG ANSWER | 0.04 s | 3 | details |
#13 | ACCEPTED | 0.05 s | 3 | details |
#14 | WRONG ANSWER | 0.05 s | 3 | details |
#15 | ACCEPTED | 0.06 s | 3 | details |
Compiler report
input/code.hs:1:1: Warning: Top-level binding with no type signature: h :: forall a. (Num a, Ord a, Read a, Show a) => a -> a -> a -> Int input/code.hs:1:5: Warning: Defined but not used: `x' input/code.hs:1:7: Warning: Defined but not used: `y' input/code.hs:24:1: Warning: Top-level binding with no type signature: f :: forall a. (Num a, Ord a, Read a, Show a) => a -> a -> a -> Int input/code.hs:24:5: Warning: Defined but not used: `x' input/code.hs:24:7: Warning: Defined but not used: `y' input/code.hs:46:1: Warning: Top-level binding with no type signature: g :: forall a a1. (Integral a1, Num a, Ord a) => a -> a -> a1 input/code.hs:50:1: Warning: Top-level binding with no type signature: main :: IO ()
Code
h 0 x y = 1 h n x y | n <= 9 = length [d | d <- [x,y], d <= n] | otherwise = let s = show n d = read [s !! 0] xres = if x < d then 2^(length s - 1) else if x == d then if n - x*10^(length s - 1) >= x*10^(length s - 2) then h (n - x*10^(length s - 1)) x y else 0 else 0 yres = if y < d then 2^(length s - 1) else if y == d then h (n - x*10^(length s - 1)) x y {-if n - y*10^(length s - 1) >= x*10^(length s - 2) then f (n - y*10^(length s - 1)) x y else 0-} else 0 in xres + yres f 0 x y = 1 f n x y | n <= 9 = length [d | d <- [x,y], d <= n] | otherwise = let s = show n d = read [s !! 0] xres = if x < d then 2^(length s - 1) else if x == d then if n - x*10^(length s - 1) >= x*10^(length s - 2) then h (n - x*10^(length s - 1)) x y else 0 else 0 yres = if y < d then 2^(length s - 1) else if y == d then if n - y*10^(length s - 1) >= x*10^(length s - 2) then h (n - y*10^(length s - 1)) x y else 0 else 0 in xres + yres + 2^(length s) - 2 g n x = let ks = takeWhile (\k -> x*10^k <= 9*n + x) [0..] in last ks main = do line <- getLine let [a,b] = map read (words line) :: [Integer] let res = sum [f b x y - f (a-1) x y | x <- [1..8], y <- [x+1..9]] - 8*sum [g b x - g (a-1) x | x <- [1..9]] putStrLn (show res)
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
2157 93337 |
correct output |
---|
1421 |
user output |
---|
1421 |
Test 2
Group: 1
Verdict: ACCEPTED
input |
---|
4875 95124 |
correct output |
---|
1278 |
user output |
---|
1278 |
Test 3
Group: 1
Verdict: WRONG ANSWER
input |
---|
5577 96352 |
correct output |
---|
1245 |
user output |
---|
1254 |
Test 4
Group: 1
Verdict: WRONG ANSWER
input |
---|
8362 92950 |
correct output |
---|
1076 |
user output |
---|
1078 |
Test 5
Group: 1
Verdict: WRONG ANSWER
input |
---|
5658 96660 |
correct output |
---|
1238 |
user output |
---|
1240 |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
51312303535233 994542403556353 |
correct output |
---|
1453976 |
user output |
---|
1472408 |
Test 7
Group: 2
Verdict: ACCEPTED
input |
---|
25636920452341 934558290712847 |
correct output |
---|
1544072 |
user output |
---|
1544072 |
Test 8
Group: 2
Verdict: ACCEPTED
input |
---|
7917952071965 985207415843573 |
correct output |
---|
1763176 |
user output |
---|
1763176 |
Test 9
Group: 2
Verdict: ACCEPTED
input |
---|
48991581181227 907034837225965 |
correct output |
---|
1380248 |
user output |
---|
1380248 |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
47968703305149 924246001328437 |
correct output |
---|
1396632 |
user output |
---|
1400728 |
Test 11
Group: 3
Verdict: WRONG ANSWER
input |
---|
292953755324413237753216241025... |
correct output |
---|
53286731528535944 |
user output |
---|
53198770598313864 |
Test 12
Group: 3
Verdict: WRONG ANSWER
input |
---|
373990979330820426927419348165... |
correct output |
---|
51580289482227600 |
user output |
---|
51509920738049936 |
Test 13
Group: 3
Verdict: ACCEPTED
input |
---|
701417326319476057561825658890... |
correct output |
---|
42924933948374952 |
user output |
---|
42924933948374952 |
Test 14
Group: 3
Verdict: WRONG ANSWER
input |
---|
177202883511434557056457305647... |
correct output |
---|
54500592365600640 |
user output |
---|
54465407993511808 |
Test 15
Group: 3
Verdict: ACCEPTED
input |
---|
977665117437419620152569155919... |
correct output |
---|
38562071809359800 |
user output |
---|
38562071809359800 |