結果

問題 No.136 Yet Another GCD Problem
ユーザー Michae'GonMichae'Gon
提出日時 2015-04-21 19:46:38
言語 Haskell
(9.8.2)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 354 bytes
コンパイル時間 725 ms
コンパイル使用メモリ 159,500 KB
実行使用メモリ 11,188 KB
最終ジャッジ日時 2023-09-18 02:21:55
合計ジャッジ時間 3,158 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,912 KB
testcase_01 AC 3 ms
6,844 KB
testcase_02 AC 2 ms
6,868 KB
testcase_03 AC 22 ms
11,016 KB
testcase_04 AC 32 ms
11,008 KB
testcase_05 AC 12 ms
10,952 KB
testcase_06 AC 12 ms
10,948 KB
testcase_07 AC 12 ms
11,080 KB
testcase_08 AC 22 ms
10,988 KB
testcase_09 AC 4 ms
8,452 KB
testcase_10 AC 22 ms
10,960 KB
testcase_11 AC 22 ms
11,020 KB
testcase_12 AC 3 ms
7,012 KB
testcase_13 AC 22 ms
10,960 KB
testcase_14 AC 32 ms
10,992 KB
testcase_15 AC 32 ms
11,008 KB
testcase_16 AC 22 ms
11,024 KB
testcase_17 AC 22 ms
11,036 KB
testcase_18 AC 3 ms
7,016 KB
testcase_19 AC 22 ms
11,096 KB
testcase_20 AC 22 ms
11,188 KB
testcase_21 AC 4 ms
8,600 KB
testcase_22 AC 3 ms
6,884 KB
testcase_23 AC 2 ms
6,964 KB
testcase_24 AC 2 ms
6,948 KB
testcase_25 AC 3 ms
6,932 KB
testcase_26 AC 2 ms
6,988 KB
testcase_27 AC 22 ms
11,008 KB
testcase_28 AC 22 ms
10,924 KB
testcase_29 AC 4 ms
8,592 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 3 ms
6,960 KB
testcase_32 AC 2 ms
6,932 KB
testcase_33 AC 3 ms
6,800 KB
testcase_34 AC 12 ms
10,976 KB
testcase_35 AC 22 ms
10,924 KB
testcase_36 AC 12 ms
10,924 KB
testcase_37 AC 32 ms
11,060 KB
testcase_38 AC 3 ms
6,892 KB
testcase_39 AC 2 ms
6,896 KB
testcase_40 AC 2 ms
6,908 KB
testcase_41 AC 3 ms
6,848 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 )

Main.hs:6:1: warning: [GHC-94817] [-Wtabs]
    Tab character found here, and in 7 further locations.
    Suggested fix: Please use spaces instead.
  |
6 |         where
  | ^^^^^^^^
[2 of 2] Linking a.out

ソースコード

diff #

main = getLine >>= print . solve . read . head . words

solve :: Int -> Int
solve n = div n $ foldl (\acc x -> if acc == n && mod n x == 0 then x else acc) n primes
	where
	primes = primes' [2..n] (sqrt $ fromIntegral n)
	primes' [] _ = []
	primes' (x : xs) mb
		| fromIntegral x < mb = x : primes' [y | y <- xs, mod y x /= 0] mb
		| otherwise = x : xs
0