結果

問題 No.48 ロボットの操縦
ユーザー pyonthpyonth
提出日時 2020-09-18 03:51:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 774 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 192,320 KB
最終ジャッジ日時 2025-01-14 15:56:23
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define rep(i, n) repl(i, 0, n)
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18 + 10;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	int x, y, l;
	cin >> y >> x >> l;
	if (x + y == 0) cout << 0 << endl;
	int ans = 0;
	if (y == 0) {
		ans = (abs(x) + l - 1) / l + (x < 0 ? 2 : 0);
	} else if (x == 0) {
		ans = (abs(y) + l - 1) / l + 1;
	} else {
		ans = (abs(x) + l - 1) / l + (abs(y) + l - 1) / l + (x > 0 ? 1 : 2);
	}
	cout << ans << endl;

	return 0;
}
0