結果

問題 No.432 占い(Easy)
ユーザー Ysmr_RyYsmr_Ry
提出日時 2016-12-17 03:21:12
言語 Haskell
(9.8.2)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 9,009 ms
コンパイル使用メモリ 164,372 KB
実行使用メモリ 31,332 KB
最終ジャッジ日時 2023-08-20 18:41:29
合計ジャッジ時間 4,337 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,892 KB
testcase_01 AC 2 ms
6,972 KB
testcase_02 AC 2 ms
6,836 KB
testcase_03 AC 2 ms
7,008 KB
testcase_04 AC 2 ms
7,404 KB
testcase_05 AC 2 ms
6,896 KB
testcase_06 AC 3 ms
7,076 KB
testcase_07 AC 3 ms
7,400 KB
testcase_08 AC 2 ms
7,076 KB
testcase_09 AC 4 ms
8,428 KB
testcase_10 AC 2 ms
7,716 KB
testcase_11 AC 7 ms
11,256 KB
testcase_12 AC 82 ms
31,332 KB
testcase_13 AC 82 ms
30,980 KB
testcase_14 AC 7 ms
11,056 KB
testcase_15 AC 2 ms
7,000 KB
testcase_16 AC 2 ms
7,036 KB
testcase_17 AC 72 ms
31,328 KB
testcase_18 AC 33 ms
15,384 KB
testcase_19 AC 22 ms
13,708 KB
testcase_20 AC 11 ms
11,276 KB
testcase_21 AC 12 ms
12,244 KB
testcase_22 AC 3 ms
7,704 KB
testcase_23 AC 3 ms
7,924 KB
testcase_24 AC 3 ms
8,460 KB
testcase_25 AC 3 ms
8,456 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Monad
import Data.Char

main :: IO ()
main = do
  t <- readLn
  replicateM_ t $ do
    xs <- getLine
    print $ head $ last $ takeWhile (not . null) $ iterate step (map digitToInt xs)

step :: [Int] -> [Int]
step xs = zipWith add xs (tail xs)
  where
    add a b
      | s >= 10   = s`div`10+s`mod`10
      | otherwise = s
      where
        s = a+b
0