結果
問題 |
No.396 クラス替え
|
ユーザー |
|
提出日時 | 2016-10-02 01:14:42 |
言語 | OCaml (5.2.1) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 648 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 19,692 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-08 23:49:48 |
合計ジャッジ時間 | 1,062 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
let getClass m xy = let xy' = xy - 1 in let isEven = (xy' / m) mod 2 = 0 in if isEven then xy' mod m else (m - 1) - (xy' mod m) let () = let _, m = read_line () |> Str.split (Str.regexp_string " ") |> List.map int_of_string |> (fun lst -> (List.nth lst 0, List.nth lst 1)) and x, y = read_line () |> Str.split (Str.regexp_string " ") |> List.map int_of_string |> (fun lst -> (List.nth lst 0, List.nth lst 1)) in let hanako = getClass m x and taro = getClass m y in (hanako = taro) |> (function | true -> "YES" | false -> "NO") |> print_endline