結果

問題 No.84 悪の算盤
コンテスト
ユーザー バカらっく
提出日時 2018-06-12 09:37:56
言語 Swift
(6.2.4)
コンパイル:
swiftc _filename_ -Ounchecked -o a.out
実行:
./a.out
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 522 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 736 ms
コンパイル使用メモリ 144,680 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2026-05-24 04:01:15
合計ジャッジ時間 1,678 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

class Proc {
    public func doProc() {
        let inpt = readLine()!.split(separator: " ").map{ Int64($0)! }
        if inpt[0] == inpt[1] {
            if(inpt[0] % 2 == 0) {
                print(inpt[0]*inpt[1]/4 - 1)
            } else {
                print((inpt[0]*inpt[1]-1)/4 + 1 - 1)
            }
        } else if inpt[0] % 2 != 0  && inpt[1] % 2 != 0 {
            print((inpt[0] * inpt[1] - 1) / 2 + 1 - 1)
        } else {
            print(inpt[0] * inpt[1] / 2 - 1)
        }
    }

}

Proc().doProc()
0