結果
問題 |
No.5003 物理好きクリッカー
|
ユーザー |
|
提出日時 | 2018-12-05 06:32:32 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 357 ms / 10,000 ms |
コード長 | 1,433 bytes |
コンパイル時間 | 4,808 ms |
実行使用メモリ | 21,948 KB |
スコア | 452,672 |
平均クエリ数 | 10000.00 |
最終ジャッジ日時 | 2021-07-19 08:43:53 |
合計ジャッジ時間 | 18,806 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 32 |
コンパイルメッセージ
Loaded package environment from /root/.ghc/x86_64-linux-8.10.4/environments/default [1 of 1] Compiling Main ( Main.hs, Main.o ) Linking a.out ...
ソースコード
-- Try yukicoder -- author: Leonardone @ NEETSDKASU import System.IO (hFlush, stdout) comm s = do putStrLn s hFlush stdout getLine return () main = do n <- readLn s <- getLine mapM_ comm $ play n s -- (名前,所有数,現在生産性,強化回数,次回購入価格,次回強化価格) items = [ ("click", 1, 1, 0, 0, 15) , ("hand", 0, 1, 0, 150, 1500) , ("lily", 0, 10, 0, 2000, 20000) , ("factory", 0, 120, 0, 30000, 300000) , ("casino", 0, 2000, 0, 600000, 6000000) , ("grimoire", 0, 25000, 0, 10000000, 100000000) ] command (cmd, _, _, _, _) = cmd product (_, prd, _, _, _) = prd updated (_, _, upd, _, _) = upd buyPrice (_, _, _, buy, _) = buy updPrice (_, _, _, _, upc) = upc play n s = game n s items 0 0 False game _ [] _ _ _ _= [] game turn es@(s:ss) items money fever sale = cmd : game (turn-1) ss items2 money2 fever2 sale2 where (cmd, items2, money1) = compute es items money fever sale money2 = money1 + calcBonus s money1 fever2 = updateFever s fever sale2 = isSale s calcBonus s money | s == 'B' = (money + 99) `div` 100 | otherwise = 0 updateFever s fever | s == 'F' = 20 | fever > 0 = fever - 1 | otherwise = 0 isSale = (== 'S') compute es items money fever sale = ("click", items, money)