結果

問題 No.443 GCD of Permutation
ユーザー atuk721atuk721
提出日時 2017-02-13 08:48:21
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 290 bytes
コンパイル時間 1,434 ms
コンパイル使用メモリ 165,240 KB
実行使用メモリ 16,648 KB
最終ジャッジ日時 2023-08-28 15:06:54
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
15,296 KB
testcase_01 AC 2 ms
7,240 KB
testcase_02 AC 2 ms
7,196 KB
testcase_03 AC 6 ms
10,992 KB
testcase_04 AC 2 ms
7,204 KB
testcase_05 AC 3 ms
6,844 KB
testcase_06 AC 3 ms
7,184 KB
testcase_07 AC 6 ms
10,852 KB
testcase_08 AC 3 ms
7,784 KB
testcase_09 AC 6 ms
10,908 KB
testcase_10 AC 3 ms
7,344 KB
testcase_11 AC 6 ms
10,812 KB
testcase_12 AC 2 ms
7,180 KB
testcase_13 AC 3 ms
7,172 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 qualified Data.List as L

main :: IO ()
main = do
  n <- getLine
  putStrLn . show . gcd' $ map read .L.permutations $ n

gcd' :: [Integer] -> Integer
gcd' (s:ss) = gcd'' s ss

gcd'' :: Integer -> [Integer] -> Integer
gcd'' 1 _ = 1
gcd'' a [] = a
gcd'' a (s:ss) = gcd'' (gcd a s) ss
0