結果

問題 No.48 ロボットの操縦
ユーザー t-0ga
提出日時 2019-07-10 14:03:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 406 bytes
コンパイル時間 1,241 ms
コンパイル使用メモリ 157,532 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 04:33:41
合計ジャッジ時間 2,077 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() 
{
  int x, y, l;
  cin >> x >> y >> l;
  int count = 0;
  if(y >= 0)
  {
      int a = (y+l-1)/l;
      count += a;
  }
  if(x != 0)
  {
      int a = (abs(x)+l-1)/l;
      count +=(a+1);
      if(y < 0) count++;
  }
  else
  {
      if(y < 0) count += 2;
  }
  if(y < 0)
  {
      int a = (abs(y)+l-1)/l;
      count += a;
  }
  cout << count;

}
0