結果

問題 No.48 ロボットの操縦
ユーザー _yoshih_
提出日時 2018-09-30 00:06:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 494 ms
コンパイル使用メモリ 65,536 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 08:54:57
合計ジャッジ時間 1,520 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <string>

using namespace std;

static void setup()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
}

static void run()
{
    int x, y, l;
    cin >> x >> y >> l;

    auto count = 0;

    if (y < 0) count += 2;  // 北から南に方向転換
    count += (abs(y) + (l - 1)) / l;

    if (x != 0) {
        if (y > 0) count += 1;  // 東か北に方向転換、 y<0 の場合は回転済み
        count += (abs(x) + (l - 1)) / l;
    }

    cout << count << endl;
}

int main(int argc, char **argv)
{
    setup();
    run();
    return 0;
}
0