結果

問題 No.48 ロボットの操縦
ユーザー oooooba
提出日時 2021-01-10 14:42:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 439 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 74,424 KB
最終ジャッジ日時 2025-01-17 15:56:05
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <optional>
#include <vector>

using namespace std;

int main() {
    int32_t x, y, l;
    cin >> x >> y >> l;
    int32_t ans = 0;
    ans += (abs(x) + l - 1) / l;
    ans += (abs(y) + l - 1) / l;
    if (x == 0) {
        ans += y < 0 ? 2 : 0;
    } else {
        ans += y < 0 ? 2 : 1;
    }
    cout << ans << endl;
    return 0;
}
0