結果
問題 | No.1006 Share an Integer |
ユーザー | ikd |
提出日時 | 2020-05-04 22:50:11 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 164 ms / 2,000 ms |
コード長 | 892 bytes |
コンパイル時間 | 5,678 ms |
コンパイル使用メモリ | 161,764 KB |
実行使用メモリ | 25,684 KB |
最終ジャッジ日時 | 2023-09-07 07:50:14 |
合計ジャッジ時間 | 9,488 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 111 ms
23,640 KB |
testcase_01 | AC | 106 ms
23,672 KB |
testcase_02 | AC | 110 ms
23,572 KB |
testcase_03 | AC | 101 ms
23,420 KB |
testcase_04 | AC | 108 ms
23,600 KB |
testcase_05 | AC | 102 ms
23,644 KB |
testcase_06 | AC | 107 ms
23,692 KB |
testcase_07 | AC | 102 ms
23,456 KB |
testcase_08 | AC | 110 ms
23,652 KB |
testcase_09 | AC | 110 ms
25,632 KB |
testcase_10 | AC | 108 ms
23,616 KB |
testcase_11 | AC | 138 ms
25,652 KB |
testcase_12 | AC | 159 ms
23,548 KB |
testcase_13 | AC | 164 ms
25,604 KB |
testcase_14 | AC | 164 ms
23,716 KB |
testcase_15 | AC | 146 ms
23,456 KB |
testcase_16 | AC | 123 ms
21,588 KB |
testcase_17 | AC | 135 ms
23,540 KB |
testcase_18 | AC | 156 ms
23,652 KB |
testcase_19 | AC | 157 ms
23,680 KB |
testcase_20 | AC | 155 ms
23,588 KB |
testcase_21 | AC | 161 ms
25,684 KB |
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
ソースコード
// Learn more about F# at http://fsharp.org open System [<EntryPoint>] let main argv = let x = stdin.ReadLine() |> int let d n = let mutable i = 1 let mutable res = 0 while i * i <= n do if n % i = 0 then if i * i = n then res <- res + 1 else res <- res + 2 i <- i + 1 res let f n = n - d n seq { for a = 1 to x - 1 do let b = x - a if (abs (a - b)) <= (x |> float |> sqrt |> int) * 2 + 10 then yield (abs (f a - f b), a, b) } |> Seq.groupBy (fun (y, _, _) -> y) |> Seq.minBy (fun (y, s) -> y) |> snd |> Seq.map (fun (y, a, b) -> (a, b)) |> Seq.sort |> Seq.iter (fun (a, b) -> printfn "%d %d" a b) 0 // return an integer exit code