結果

問題 No.48 ロボットの操縦
ユーザー ミドリムシ
提出日時 2017-10-14 04:44:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 906 ms
コンパイル使用メモリ 55,012 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-17 13:10:18
合計ジャッジ時間 1,187 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
 
int main(){
	int X, Y, L;
	cin >> X >> Y >> L;
	if(Y == 0){
		if(X == 0){
			cout << 0 << endl;
		}else{
			cout << (abs(X / L) - 1) + 2 << endl;
		}
	}else if(Y <= 0){
		if(X == 0){
			cout << (-1 * Y - 1) / L + 3 << endl;
		}else{
			cout << (abs(X) - 1) / L + (-1 * Y - 1) / L + 3 << endl;
		}
	}else{
		if(X == 0){
			cout << (Y - 1) / L + 1 << endl;
		}else{
			cout << (abs(X) - 1) / L + (Y - 1) / L + 3 << endl;
		}
	}
}
0