結果

問題 No.48 ロボットの操縦
ユーザー kendemu
提出日時 2014-12-21 17:28:17
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 58,924 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-12 03:12:21
合計ジャッジ時間 1,612 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>

int main(){
  long long x,y,l;
  std::cin >> x;
  std::cin >> y;
  std::cin >> l;
  long long  sum = 0;
  if(y >= 0){
    sum = std::ceil(y/l);
  }
  if(x == 0){
    sum += std::ceil(x/l);
  }
  if(x > 0){
    sum += std::ceil(x/l) + 1;
  }
  if(x < 0){
    sum += std::ceil(x * -1/l) + 1;
  }
  if(x != 0 && y < 0){
    sum += std::ceil(y * -1/l) + 1;
  }
  if(x == 0 && y < 0){
    sum += std::ceil(y*-1/l) + 2;
  }
  std::cout << sum << std::endl;
}


0