結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー jugemjugemjugemjugemjugemjugem
提出日時 2017-12-19 00:16:46
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 324 bytes
コンパイル時間 10,205 ms
コンパイル使用メモリ 165,612 KB
実行使用メモリ 7,188 KB
最終ジャッジ日時 2023-08-22 06:09:38
合計ジャッジ時間 11,904 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,064 KB
testcase_01 AC 3 ms
6,964 KB
testcase_02 AC 2 ms
7,148 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 3 ms
6,980 KB
testcase_06 AC 3 ms
6,996 KB
testcase_07 AC 2 ms
7,004 KB
testcase_08 AC 2 ms
6,972 KB
testcase_09 AC 3 ms
6,988 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
7,048 KB
testcase_16 AC 3 ms
7,068 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 2 ms
7,028 KB
testcase_22 AC 2 ms
7,020 KB
testcase_23 AC 3 ms
6,972 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 Control.Applicative
import Data.List

main = do
  t <- readLn

  putStrLn $ show $ solve t

solve :: Int -> Int
solve n = numx n + (lastx $ n - (2 ^ (numx n)))

numx :: Int -> Int
numx n = (floor (logBase 2 (fromIntegral n)))

lastx :: Int -> Int
lastx n
  | (mod n 2) == 0 = 0
  | otherwise = 1
0