結果

問題 No.48 ロボットの操縦
ユーザー eyeSharp
提出日時 2019-10-10 00:57:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 472 bytes
コンパイル時間 1,337 ms
コンパイル使用メモリ 158,040 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-18 11:03:34
合計ジャッジ時間 2,233 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
    No.48 ロボットの操縦
    https://yukicoder.me/problems/no/48
*/
#include <bits/stdc++.h>
using namespace std;

int calc(int x, int l) {
    return ceil(abs(x) / l);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    long int dist = 0;
    long int x, y, l;
    cin >> x >> y >> l;

    dist += calc(x, l);
    dist += calc(y, l);

    if (y < 0)
        dist += 2;
    else if (x != 0 && y >= 0)
        dist += 1;

    cout << dist << endl;
}
0