結果

問題 No.48 ロボットの操縦
ユーザー m
提出日時 2020-07-16 06:29:26
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 482 bytes
コンパイル時間 598 ms
コンパイル使用メモリ 64,524 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-23 22:25:52
合計ジャッジ時間 1,454 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main() {
  int x, y, l;
  int cnt = 0;
  cin >> x >> y >> l;

  if (y < 0) {
    cnt += 3;
  } else {
    cnt ++;
  }
  if (x == 0){
    cnt --;
  }
  if (y == 0){
    cnt --;
  }

  if (x < 0) {
    x *= -1;
  }
  if (y < 0) {
    y *= -1;
  }
  if ((x%l) == 0){
    cnt += (x/l);
  } else {
    cnt += ((x/l) + 1);
  }
  if ((y%l) == 0){
    cnt += (y/l);
  } else {
    cnt += ((y/l) + 1);
  }

  cout << cnt << endl;
  return 0;
}
0