結果

問題 No.48 ロボットの操縦
ユーザー kendemu
提出日時 2014-12-21 17:30:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 492 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 60,592 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 18:14:29
合計ジャッジ時間 1,295 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>

int main(){
  long double 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