結果

問題 No.48 ロボットの操縦
ユーザー T.Stream
提出日時 2020-04-14 14:07:23
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 442 bytes
コンパイル時間 2,201 ms
コンパイル使用メモリ 192,544 KB
最終ジャッジ日時 2025-01-09 18:37:19
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    long x,y,l;
    cin >> x >> y >> l;
    if(y==0){
    	if(x==0){
    		cout << 0 << endl;
    	}else{
    		cout << 1+(abs(x)+l-1)/l << endl;
    	}
    }else if(y>0){
    	if(x==0){
    		cout << (abs(y)+l-1)/l << endl;
    	}else{
    		cout << 1+(abs(y)+l-1)/l+(abs(x)+l-1)/l << endl;
    	}
    }else{
    	cout << 2+(abs(y)+l-1)/l+(abs(x)+l-1)/l << endl;
    }
	return 0;
}
0