結果

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

ソースコード

diff #

#include <iostream>
#include <sstream>

using namespace std;

int main(int argc, char *argv[])
{
	int X, Y, L;
	cin >> X >> Y >> L;
	int ans = 0;
	if (Y > 0) {
		ans += (Y + L - 1) / L;
		Y = 0;
	}
	if (X || Y) {
		++ans;
		ans += (abs(X) + L - 1) / L;
	}
	if (Y) {
 		++ans;
		ans += (-Y + L - 1) / L;
	}
	cout << ans << endl;
	return 0;
}
0