結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー vjudge1
提出日時 2026-11-23 17:40:14
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 3,728 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 758 ms
コンパイル使用メモリ 147,084 KB
実行使用メモリ 9,908 KB
最終ジャッジ日時 2026-11-23 17:40:17
合計ジャッジ時間 3,233 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <cctype>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <functional>
#include <set>
#include <tuple>
#include <bitset>
#include <unordered_set>
#include <queue>
#include <numeric>
#include <iomanip>
#include <stack>

using namespace std;

#define ll long long int
#define ld long double

#define forr(i, a, b) for(ll i=a; i<b; i++)
#define forn(i, a, b) for(ll i=a-1; i>=b; i--)
#define forv(vec) for(auto &val: vec)

#define re return
#define nl '\n'

#define st set<long long>
#define queue queue<long long>
#define stack stack<long long>
#define tll tuple<ll, ll, ll>
#define mp map<long long, long long>
#define maxpq priority_queue<ll>
#define minpq priority_queue<ll, vector<ll>, greater<ll>>
#define pll pair<long long, long long>
#define bits(n) bitset<n> //set reset flip test
#define vll vector<long long>
#define vb vector<bool>
#define vch vector<char>
#define vstr vector<string>
#define vvll vector< vector<long long>>
#define vvch vector< vector<char>>
#define vvstr vector< vector<string>>
#define vvb vector< vector<bool>>
#define vpll vector< pair<long long, long long>>

#define pb push_back
#define pop pop_back
#define fs first
#define sc second
#define all(vec) vec.begin(), vec.end()
#define allr(vec) vec.rbegin(), vec.rend()
#define fill_iota(vec, val) iota(all(vec), val)
#define sorta(vec) sort(all(vec))
#define sortd(vec) sort(vec.begin(), vec.end(), [](long long a, long long b){return a>b;})
#define uni(vec) unique(all(vec)) // moves consecutive same elements to last indexes and returns it from which only same element remains
#define permu(vec) next_permutation(all(vec)) //prev_permutation()
#define best_search(vec, x) binary_search(all(vec), x)
#define lower(vec, x) lower_bound(all(vec), x)
#define upper(vec, x) upper_bound(all(vec), x)
//gcd(a, b) or lcm(a, b)
#define arr_product(vec) accumulate(all(vec), 0LL, [](ll a, ll b){ return a * b; })
#define arr_sum(vec) accumulate(all(vec), 0LL)

ostream& operator<<(ostream &out, const vll &vec){
    for(int i=0; i<vec.size(); i++){ out<<vec[i]; if(i!=vec.size()-1) out<<" "; }
    return out;
}

istream& operator>>(istream &in, vll &vec){
    for(auto &val: vec) in>>val;
    return in;
}

istream& operator>>(istream &in, pll &p) {
    in >> p.first >> p.second;
    return in;
}

ostream& operator<<(ostream &out, pll &p) {
    out << p.first << p.second;
    return out;
}

#define M 1000000007

ll power(ll val, ll p){ ll r = 1; val %= M; while(p){ if(p&1) r = r*val%M; val = val*val%M; p >>= 1; } return r; }
ll combination(ll n, ll r){ if (r < 0 || r > n) return 0; r = min(r, n - r); ll result = 1;
forr(i, 1, r+1) { result = result * (n - r + i) / i;} return result; }
ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a%b); }
bool isPrime(ll n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (ll i = 5; i*i <= n; i += 6)
if (n % i == 0 || n % (i+2) == 0) return false; return true;}

#define enter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

void solve(){
    ll x, y, l;
    cin>>x>>y>>l;
    ll ans=0;

    if(y<0){
        ans+=2;
        y*=-1;
        ans += (y%l==0 ? y/l : (y/l)+1);
    }else{
        ans += (y%l==0 ? y/l : (y/l)+1);
    }


    if(x!=0){
        if(x<0) x*=-1;
        ans++;
        ans += (x%l==0 ? x/l : (x/l)+1);
    }

    cout<<ans;
}

int main(){
    enter

    //#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //#endif

    int t=1;
    //cin>>t;
    while(t--){
        solve();
        if(t>0) cout << nl;
    }
    return 0;
}
0