結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー ry0u_yd
提出日時 2015-04-03 05:46:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 626 bytes
コンパイル時間 504 ms
コンパイル使用メモリ 60,260 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 01:34:39
合計ジャッジ時間 1,231 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
typedef long long ll;

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

	ll ans = 0;
	if(y > 0)
	{
		if(y%l == 0) ans += y/l;
		else ans += y/l + 1;
	}
	else if(y < 0)
	{
		y = -y;
		ans++;

		if(y%l == 0) ans += y/l;
		else ans += y/l + 1;
	}

	if(x > 0)
	{
		ans++;
		if(x%l == 0) ans += x/l;
		else ans += x/l + 1;
	}
	else if(x < 0)
	{
		x = -x;
		ans++;

		if(x%l == 0) ans += x/l;
		else ans += x/l + 1;
	}

	cout << ans << endl;

	return 0;
}
0