結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー FF256grhy
提出日時 2016-09-05 02:18:05
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 623 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 188 ms
コンパイル使用メモリ 38,656 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-05-15 22:35:36
合計ジャッジ時間 1,178 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>

#define FOR(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define REV(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define INC(i, n) FOR(i, 0, n)
#define DEC(i, n) REV(i, 0, n)
#define INC1(i, n) FOR(i, 1, (n) + 1)
#define DEC1(i, n) REV(i, 1, (n) + 1)

typedef long long   signed int LL;
typedef long long unsigned int LU;

template<typename T> inline T abs(T x) { return (x > 0 ? x : -x); }

int x, y, l;

int main() {
	scanf("%d%d%d", &x, &y, &l);
	
	int xx = (abs(x) + l - 1) / l;
	int yy = (abs(y) + l - 1) / l;
	int r = (y < 0 ? 2 : (x != 0 ? 1 : 0));
	
	printf("%d\n", xx + yy + r);
	
	return 0;
}
0