結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー vjudge1
提出日時 2026-11-23 16:34:32
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 5,000 ms
+ 791µs
コード長 1,307 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,307 ms
コンパイル使用メモリ 334,808 KB
実行使用メモリ 9,912 KB
最終ジャッジ日時 2026-11-23 16:34:37
合計ジャッジ時間 4,813 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

// #ifndef ONLINE_JUDGE
//     #include "debug/debug_template.cpp"
// #else
//     #define debug(...)
//     #define debugArr(...)
// #endif

#define ll long long
#define nl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define int long long
#define pii pair<int, int>
#define double long double
#define pb push_back
#define here cout << "HERE" << nl;
#define forn(i, a, n) for (int i = a; i < n; i++)
#define print(a)          \
    for (auto &e : a)     \
        cout << e << " "; \
    cout << nl;
#define all(a) a.begin(), a.end()
#define MOD(a, b) ((a % b) + b) % b
#define yesno(b) cout << ((b) ? "YES\n" : "NO\n")
template <typename T>
using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
using namespace std;
void solve()
{
    int x, y;
    cin >> x >> y;
    int l;
    cin >> l;
    int ans = 0;
    ans += abs(x / l);
    if (abs(x % l) != 0)
        ans++;
    ans += abs(y / l);
    if (abs(y % l) != 0)
        ans++;
    // rotation
    if (x != 0)
    {
        ans++;
        if(y<0)ans++;
    }
    else{
        if(y<0)ans+=2;
    }
    cout<<ans<<nl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
0