結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー vjudge1
提出日時 2026-11-23 16:29:43
言語 C++17(clang)
(clang++ 23.1.4 + boost 1.92.0 + ACL)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 3,253 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,848 ms
コンパイル使用メモリ 174,592 KB
実行使用メモリ 9,928 KB
最終ジャッジ日時 2026-11-23 16:29:52
合計ジャッジ時間 3,931 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

//Bismillah
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define nl cout << "\n";
#define YN(condition) cout << (condition ? "YES" : "NO")
#define yn(condition) cout << (condition ? "Yes" : "No")

#define int long long
#define lint __int128
#define ll long long
#define ld long double
#define pii pair<int,int>
const int inf = 1e17;
const int MOD = 1000000007;

#define ac(n) array<char,n>
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define mp map<int,int>
#define pq priority_queue<int>
#define pqmin priority_queue<int, vector<int>, greater<int>>
#define pqminpair priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>

#define f(i,s,e) for(int i=s;i<e;i++)
#define fn(i,s,e) for(int i=s;i>=e;i--)
#define printv(vec) for(auto &value: vec) cout << value << " ";
#define inputv(vec) for(auto &value: vec) cin >> value;

#define pb push_back
#define pp pop_back
#define all(s) s.begin(), s.end()
#define sa(vec) sort(vec.begin(), vec.end())
#define sd(vec) sort(vec.begin(), vec.end(), [](int a, int b){ return a > b; })

template <typename T>
using ordered_set = tree<
    T,           // key type
    null_type,   // mapped type (null => set)
    less<T>,     // ordering
    rb_tree_tag, // red-black tree
    tree_order_statistics_node_update>;
// .find_by_order(k) returns iterator of kth smallest element (0 based)
// .order_of_key(k) returns number of elements < x

template <typename A, typename B>
istream& operator>>(istream &in, pair<A,B> &p) {
    in >> p.first >> p.second;
    return in;
}
template <typename T>
istream& operator>>(istream &in, vector<T> &v) {
    for (auto &x : v) in >> x;
    return in;
}
template <typename A, typename B>
istream& operator>>(istream &in, vector<pair<A,B>> &vp) {
    for (auto &p : vp) in >> p.first >> p.second;
    return in;
}
template <typename A, typename B>
ostream& operator<<(ostream &out, const pair<A,B> &p) {
    out << p.first << " " << p.second;
    return out;
}
template <typename T>
ostream& operator<<(ostream &out, const vector<T> &v) {
    for (auto &x : v) out << x << " ";
    return out;
}
template <typename A, typename B>
ostream& operator<<(ostream &out, const vector<pair<A,B>> &vp) {
    for (auto &p : vp) out << p.first << " " << p.second << "\n";
    return out;
}

#define fastnuces ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t = 1;
int test = 0;
void solve() {
    int x, y, l;
    cin >> x >> y >> l;
    int a = x/l;
    int b = y/l;
    int c = x%l;
    int d = y%l;
    int e = (c > 0 ? 1 : 0);
    e += (d > 0 ? 1 : 0);
    e += abs(a) + abs(b);
    if (x > 0 || x < 0) e++;
    if (y < 0) e++;
    // if (x > 0) e++;
    // else if (y > 0) e++;
    // else if (x < 0) e++;
    // else if (y < 0) e++;
    
    if (x == 0 && y < 0) e++;
    cout << e;
    // nl
    // cout << (-7 % 7);
}
signed main() {
    fastnuces;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    // cin >> t;
    while (t--) {
        test++;
        solve();
        nl
    }
    return 0;
}
0