結果

問題 No.48 ロボットの操縦
ユーザー mkanenobumkanenobu
提出日時 2018-03-25 13:19:56
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 594 bytes
コンパイル時間 3,120 ms
コンパイル使用メモリ 66,672 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 05:37:31
合計ジャッジ時間 3,820 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils, strutils, math

var
    x = readLine(stdin).parseInt
    y = readLine(stdin).parseInt
    l = readLine(stdin).parseInt

proc main():int =
    result += int(ceil(x.abs / l) + ceil(y.abs / l))
    if x == 0:
        if y > 0:
            return
        elif y < 0:
            return result + 2
    elif y == 0:
        return result + 1
    elif x > 0:
        if y > 0:
            return result + 1
        elif y < 0:
            return result + 2
    elif x < 0:
        if y > 0:
            return result + 1
        elif y < 0:
            return result + 2

echo main()
0