結果

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

ソースコード

diff #

#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(x == 0) {
    cnt = 0;
  } else if(y < 0) {
    cnt += 2;
  } else {
    cnt++;
  }

  if(x < 0)
    x *= -1;

  if(y < 0)
    y *= -1;

  int distX = x / l + (x % l != 0);
  int distY = y / l + (y % l != 0);
  cout << distX + distY + cnt << '\n';
}

0