Submission #861742


Source Code Expand

import System.Random
main :: IO ()
main = do
  a <- readLn
  putStrLn $ calc a

calc i
 | i < 100 = "00"
 | i < 1000 = "0" ++ (show $ i `div` 100)
 | i <= 5000  = show $ i `div` 100
 | (6000 <= i && i <= 30000) = show $ 50 + i `div` 1000
 | (35000 <= i && i <= 70000) = show $ (i `div` 1000 - 30) `div` 5 + 80
 | otherwise = "89"
  
-- let
{--
cylinder :: Double -> Double -> Double
cylinder r h =
  let sideArea = 2 * pi * r * h
      topArea = pi * r ^ 2
  in  sideArea + 2 * topArea
--}

{--
calcBmis :: [(Double,Double)] -> [Double]
calcBmis xs = [bmi w h | (w, h) <- xs]
  where bmi weight height = weight / height ^ 2
--}

{--
initials :: String -> String -> String
initials firstname lastname = [f] ++ ". " ++ [l] ++ "."
  where
    (f:_) = firstname
    (l:_) = lastname
--}

{--
-- パターンマッチとwhere
bmiTell :: Double -> Double -> String
bmiTell weight height
  | bmi <= skynny = "You're underweight, you emo, you!"
  | bmi <= normal = "You're supposedly normal. Pffft, I bet you're ugly!"
  | bmi <= fat = "You're fat! Lose some weight, fatty!"
  | otherwise   = "You're a whale, congratulations!"
  where
    bmi = weight / height ^ 2
    (skynny,normal,fat) = (18.5,25.0,30.0)
--}

{--
-- whereのスコープ
-- いいパターン
badGreeting :: String
badGreeting = "Oh! Pfft. It's you."

niceGreeting :: String
niceGreeting = "Hello! So very nice to see you,"

greet :: String -> String
greet "Juan" = niceGreeting ++ " Juan!"
greet "Fernando" = niceGreeting ++ " Fernando!"
greet name = badGreeting ++ " " ++ name
--}
{--
-- ダメパターン(変数はグローバル変数じゃないと動かない!)
  where
    niceGreeting = "Hello! So very nice to see you,"
    vadGreeting = "Oh! Pfft. It's you."
--}

{--  
-- whereを使ってbmiTellを綺麗にする
bmiTell :: Double -> Double -> String
bmiTell weight height
  | bmi <= skynny = "You're underweight, you emo, you!"
  | bmi <= normal = "You're supposedly normal. Pffft, I bet you're ugly!"
  | bmi <= fat = "You're fat! Lose some weight, fatty!"
  | otherwise   = "You're a whale, congratulations!"
  where
    bmi = weight / height ^ 2
    skynny = 18.5
    normal = 25.0
    fat = 30.0
--}

{--
myCompare :: (Ord a) => a -> a -> Ordering
a `myCompare` b
  | a == b = EQ
  | a <= b = LT
  | otherwise = GT

max' :: (Ord a) => a -> a -> a
max' a b
  | a < b = b
  | otherwise = a
--}

{--
-- ガード(引数複数個)
bmiTell :: Double -> Double -> String
bmiTell weight height
  | weight / height ^ 2 <= 18.5 = "You're underweight, you emo, you!"
  | weight / height ^ 2 <= 25.0 = "You're supposedly normal. Pffft, I bet you're ugly!"
  | weight / height ^ 2 <= 30.0 = "You're fat! Lose some weight, fatty!"
  | otherwise   = "You're a whale, congratulations!"
--}

{--
-- ガード(引数1個)
bmiTell :: Double -> String
bmiTell bmi
  | bmi <= 18.5 = "You're underweight, you emo, you!"
  | bmi <= 25.0 = "You're supposedly normal. Pffft, I bet you're ugly!"
  | bmi <= 30.0 = "You're fat! Lose some weight, fatty!"
  | otherwise   = "You're a whale, congratulations!"
--}

{--
-- asパターン  
firstLetter :: String -> String
firstLetter "" = "Empty string, whoops!"
firstLetter all@(x:xs) = "The first letter of " ++ all ++ " is " ++ [x]
--firstLetter (x:xs) = "The first letter of " ++ (x:xs) ++ " is " ++ [x]
--}

{--
tell :: (Show a) => [a] -> String
tell [] = "The list is empty."
tell (x:[]) = "The list has one element: " ++ (show x)
tell (x:y:[]) = "The list has two element: " ++ (show x) ++ " and " ++ (show y)
tell (x:y:_) = "The list is long. The first two elements are: " ++ (show x) ++ " and " ++ (show y)
--}

{--
head' :: [a] -> a
head' [] = error "Can't call head on an empty list, dummy!"
head' (x:_) = x
--}
  

Submission Info

Submission Time
Task B - 視程の通報
User zaichu_boc
Language Haskell (GHC 7.4.1)
Score 100
Code Size 3871 Byte
Status AC
Exec Time 32 ms
Memory 1096 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 38
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.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
Case Name Status Exec Time Memory
00_sample_01.txt AC 31 ms 1052 KB
00_sample_02.txt AC 28 ms 1056 KB
00_sample_03.txt AC 30 ms 1076 KB
test_01.txt AC 29 ms 1052 KB
test_02.txt AC 28 ms 1052 KB
test_03.txt AC 30 ms 1044 KB
test_04.txt AC 30 ms 1040 KB
test_05.txt AC 32 ms 1040 KB
test_06.txt AC 28 ms 1048 KB
test_07.txt AC 29 ms 1048 KB
test_08.txt AC 28 ms 1036 KB
test_09.txt AC 29 ms 1044 KB
test_10.txt AC 29 ms 1040 KB
test_11.txt AC 29 ms 1040 KB
test_12.txt AC 30 ms 1044 KB
test_13.txt AC 31 ms 1084 KB
test_14.txt AC 31 ms 1088 KB
test_15.txt AC 30 ms 1044 KB
test_16.txt AC 31 ms 1044 KB
test_17.txt AC 30 ms 1048 KB
test_18.txt AC 29 ms 1048 KB
test_19.txt AC 29 ms 1048 KB
test_20.txt AC 29 ms 1056 KB
test_21.txt AC 30 ms 1040 KB
test_22.txt AC 30 ms 1044 KB
test_23.txt AC 30 ms 1044 KB
test_24.txt AC 28 ms 1092 KB
test_25.txt AC 28 ms 1096 KB
test_26.txt AC 30 ms 1040 KB
test_27.txt AC 29 ms 1088 KB
test_28.txt AC 30 ms 1048 KB
test_29.txt AC 28 ms 1040 KB
test_30.txt AC 29 ms 1096 KB
test_31.txt AC 29 ms 1048 KB
test_32.txt AC 30 ms 1048 KB
test_33.txt AC 30 ms 1036 KB
test_34.txt AC 29 ms 1044 KB
test_35.txt AC 31 ms 1040 KB