結果

問題 No.48 ロボットの操縦
ユーザー ふう
提出日時 2015-01-26 16:40:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 692 bytes
コンパイル時間 943 ms
コンパイル使用メモリ 81,028 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 18:15:29
合計ジャッジ時間 1,372 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <map>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>

using namespace std;

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

	if (y == 0 && x == 0) {
		cout << 0 << endl;
		return (0);
	}
	if (x == 0 && y < 0) 
		res += 1; 

	if (x < 0) x = -x;

	if (y <= 0) {
		res += 1;
		y = -y;
	}
	if(x != 0 && y != 0) {
		res += 1;
	}
	

	res += x / l;
	if (x % l != 0) res += 1;
	res += y / l;
	if (y % l != 0) res += 1;

	cout << res << endl;

	return (0);
}
0