結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2020-10-03 08:10:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 1,882 ms |
コンパイル使用メモリ | 191,532 KB |
最終ジャッジ日時 | 2025-01-15 01:54:24 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))#define precise(i) fixed << setprecision(i)#define rep(i, n) for (int i = 0; i < (int)(n); i++)using namespace std;int main() {fastIO;int x, y, l, cnt = 0;cin >> x >> y >> l;if(y >= 0) {if(x == 0) {cnt = 0;} else {cnt++;}} else {cnt += 2;}x = abs(x), y = abs(y);int cntX = x / l + (x % l != 0);int cntY = y / l + (y % l != 0);if(x == 0) {cout << cntY + cnt << '\n';} else if(y == 0) {cout << cntX + cnt << '\n';} else {cout << cntX + cntY + cnt << '\n';}}