結果

問題 No.48 ロボットの操縦
ユーザー hiyori
提出日時 2016-11-12 19:28:25
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 1,404 ms
コンパイル使用メモリ 55,144 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-25 21:27:58
合計ジャッジ時間 1,985 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int action (int num, int l)
{
  int count = 0;

  if (num >= l) {
    count += num/l;
    num = num % l;
  }
  count += num;

  return count;
}

int main ()
{
  int x, y, l;
  cin >> x >> y >> l;
  if (x < 0) x *= -1;
    if (y < 0) y *= -1;
    int count = 0;
    if (y) count = 1;
    else if (!y) count = 2;
    count += action(y,l)+action(x,l);
  
  cout << count << endl;
  return 0;
}
0