Submission #108274


Source Code Expand

import Control.Applicative

main :: IO ()
main = do [deg,dis] <- (map read . words) <$> getLine
          putStrLn $ h deg dis
-- |
-- >>> h 2750 628
-- "W 5"
-- >>> h 161 8
-- "C 0"
-- >>> h 3263 15
-- "NNW 1"
-- >>> h 1462 1959
-- "SE 12"
-- >>> h 1687 1029
-- "SSE 8"
-- >>> h 2587 644
-- "WSW 5"
-- >>> h 113 201
-- "NNE 3"
-- >>> h 2048 16
-- "SSW 1"
f :: Int -> String
f x | x >= 113 && x <= 337 = "NNE"
    | x >= 338 && x <= 562 = "NE"
    | x >= 563 && x <= 787 = "ENE"
    | x >= 788 && x <= 1012 = "E"
    | x >= 1013 && x <= 1237 = "ESE"
    | x >= 1238 && x <= 1462 = "SE"
    | x >= 1463 && x <= 1687 = "SSE"
    | x >= 1688 && x <= 1912 = "S"
    | x >= 1913 && x <= 2137 = "SSW"
    | x >= 2138 && x <= 2362 = "SW"
    | x >= 2363 && x <= 2587 = "WSW"
    | x >= 2588 && x <= 2812 = "W"
    | x >= 2813 && x <= 3037 = "WNW"
    | x >= 3038 && x <= 3262 = "NW"
    | x >= 3263 && x <= 3487 = "NNW"
    | otherwise = "N"
g :: Int -> String
g x | x' >= 0 && x' <= 24 = "0"
    | x' >= 25 && x' <= 154 = "1"
    | x' >= 155 && x' <= 334 = "2"
    | x' >= 335 && x' <= 544 = "3"
    | x' >= 545 && x' <= 794 = "4"
    | x' >= 795 && x' <= 1074 = "5"
    | x' >= 1075 && x' <= 1384 = "6"
    | x' >= 1385 && x' <= 1714 = "7"
    | x' >= 1715 && x' <= 2074 = "8"
    | x' >= 2075 && x' <= 2444 = "9"
    | x' >= 2445 && x' <= 2844 = "10"
    | x' >= 2845 && x' <= 3264 = "11"
    | x' >= 3265 = "12"
  where x' = x * 10 `div` 6


h :: Int -> Int -> String
h x y = h' (f x) (g y)
  where
    h' _ "0" = "C 0"
    h' dir w = dir ++ " " ++ w

Submission Info

Submission Time
Task C - 風力観測
User yuuki
Language Haskell (GHC 7.4.1)
Score 100
Code Size 1609 Byte
Status AC
Exec Time 31 ms
Memory 1064 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 66
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 00_sample_06.txt, 00_sample_07.txt, 00_sample_08.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 21 ms 928 KB
00_sample_02.txt AC 24 ms 924 KB
00_sample_03.txt AC 23 ms 1060 KB
00_sample_04.txt AC 24 ms 1064 KB
00_sample_05.txt AC 21 ms 932 KB
00_sample_06.txt AC 22 ms 1056 KB
00_sample_07.txt AC 23 ms 932 KB
00_sample_08.txt AC 23 ms 1060 KB
test_01.txt AC 23 ms 1016 KB
test_02.txt AC 23 ms 1064 KB
test_03.txt AC 24 ms 932 KB
test_04.txt AC 23 ms 928 KB
test_05.txt AC 31 ms 1056 KB
test_06.txt AC 24 ms 932 KB
test_07.txt AC 23 ms 928 KB
test_08.txt AC 22 ms 932 KB
test_09.txt AC 23 ms 1016 KB
test_10.txt AC 22 ms 928 KB
test_11.txt AC 23 ms 1060 KB
test_12.txt AC 24 ms 940 KB
test_13.txt AC 21 ms 928 KB
test_14.txt AC 24 ms 936 KB
test_15.txt AC 22 ms 924 KB
test_16.txt AC 23 ms 1056 KB
test_17.txt AC 21 ms 1056 KB
test_18.txt AC 23 ms 936 KB
test_19.txt AC 22 ms 1064 KB
test_20.txt AC 23 ms 1060 KB
test_21.txt AC 23 ms 932 KB
test_22.txt AC 23 ms 932 KB
test_23.txt AC 23 ms 932 KB
test_24.txt AC 21 ms 932 KB
test_25.txt AC 24 ms 928 KB
test_26.txt AC 23 ms 928 KB
test_27.txt AC 23 ms 924 KB
test_28.txt AC 23 ms 1060 KB
test_29.txt AC 23 ms 932 KB
test_30.txt AC 23 ms 992 KB
test_31.txt AC 23 ms 996 KB
test_32.txt AC 24 ms 936 KB
test_33.txt AC 23 ms 932 KB
test_34.txt AC 22 ms 924 KB
test_35.txt AC 23 ms 1056 KB
test_36.txt AC 21 ms 932 KB
test_37.txt AC 22 ms 936 KB
test_38.txt AC 21 ms 1052 KB
test_39.txt AC 23 ms 928 KB
test_40.txt AC 23 ms 936 KB
test_41.txt AC 23 ms 1056 KB
test_42.txt AC 24 ms 940 KB
test_43.txt AC 23 ms 1056 KB
test_44.txt AC 25 ms 936 KB
test_45.txt AC 23 ms 928 KB
test_46.txt AC 23 ms 928 KB
test_47.txt AC 26 ms 1012 KB
test_48.txt AC 22 ms 932 KB
test_49.txt AC 22 ms 1048 KB
test_50.txt AC 24 ms 1064 KB
test_51.txt AC 24 ms 1052 KB
test_52.txt AC 30 ms 992 KB
test_53.txt AC 23 ms 1064 KB
test_54.txt AC 22 ms 932 KB
test_55.txt AC 24 ms 1052 KB
test_56.txt AC 21 ms 932 KB
test_57.txt AC 21 ms 928 KB
test_58.txt AC 24 ms 1056 KB