結果

問題 No.48 ロボットの操縦
ユーザー ermine
提出日時 2023-01-24 22:41:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 314 bytes
コンパイル時間 2,189 ms
コンパイル使用メモリ 192,264 KB
最終ジャッジ日時 2025-02-10 06:35:40
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int x,y,l,ans=0;
    cin>>x>>y>>l;

    ans += abs(x)/l;
    if(x%l) ans++;
    ans += abs(y)/l;
    if(y%l) ans++;

    if(x==0){
        if(y<0) ans+=2;
    } else {
        ans++;
        if(y<0) ans++;
    }

    cout<<ans<<endl;
    return 0;
}
0