結果

問題 No.939 and or
ユーザー guriceringuricerin
提出日時 2020-01-02 10:50:25
言語 F#
(F# 4.0)
結果
AC  
実行時間 343 ms / 2,000 ms
コード長 962 bytes
コンパイル時間 12,398 ms
コンパイル使用メモリ 199,588 KB
実行使用メモリ 34,864 KB
最終ジャッジ日時 2024-05-02 06:19:56
合計ジャッジ時間 23,157 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 335 ms
34,500 KB
testcase_01 AC 64 ms
30,208 KB
testcase_02 AC 336 ms
34,356 KB
testcase_03 AC 63 ms
30,336 KB
testcase_04 AC 334 ms
33,724 KB
testcase_05 AC 337 ms
34,620 KB
testcase_06 AC 343 ms
33,988 KB
testcase_07 AC 340 ms
34,732 KB
testcase_08 AC 339 ms
33,904 KB
testcase_09 AC 65 ms
29,824 KB
testcase_10 AC 337 ms
34,512 KB
testcase_11 AC 337 ms
33,604 KB
testcase_12 AC 336 ms
33,724 KB
testcase_13 AC 336 ms
34,492 KB
testcase_14 AC 339 ms
34,496 KB
testcase_15 AC 339 ms
34,864 KB
testcase_16 AC 63 ms
30,188 KB
testcase_17 AC 335 ms
34,348 KB
testcase_18 AC 338 ms
33,956 KB
testcase_19 AC 337 ms
33,732 KB
testcase_20 AC 335 ms
33,856 KB
testcase_21 AC 337 ms
33,976 KB
testcase_22 AC 63 ms
30,464 KB
testcase_23 AC 335 ms
33,944 KB
testcase_24 AC 334 ms
34,048 KB
testcase_25 AC 336 ms
34,624 KB
testcase_26 AC 337 ms
34,360 KB
testcase_27 AC 340 ms
34,496 KB
testcase_28 AC 340 ms
34,464 KB
testcase_29 AC 334 ms
34,200 KB
testcase_30 AC 63 ms
30,252 KB
testcase_31 AC 336 ms
33,868 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (365 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.fs(27,9): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

open System
open System.Collections.Generic

[<AutoOpen>]
module Cin =
    let read f = stdin.ReadLine() |> f
    let reada f = stdin.ReadLine().Split() |> Array.map f

    let readInts() =
        read string
        |> Seq.toArray
        |> Array.map (fun x -> Convert.ToInt32(x.ToString()))

module Util =
    let strRev s =
        s
        |> Seq.rev
        |> Seq.map string
        |> String.concat ""

    let inline roundup (a: ^t) (b: ^t): ^t =
        let one = LanguagePrimitives.GenericOne
        (a + b - one) / b

[<EntryPoint>]
let main _ =
    let [|a;b|] = reada int64

    if (a &&& b <> a) then
        printfn "0"
    else
        let mutable ca = 0
        let mutable cb = 0
        for i in 0..33 do
            if (a >>> i) &&& 1L = 1L then ca <- ca + 1
            if (b >>> i) &&& 1L = 1L then cb <- cb + 1
        let e = max (cb - ca - 1) 0
        let ans = 1 <<< e
        printfn "%d" ans
    0 // return an integer exit code
0