結果

問題 No.48 ロボットの操縦
ユーザー Elizack
提出日時 2020-02-05 18:52:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 844 ms / 5,000 ms
コード長 622 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 63,792 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 20:19:04
合計ジャッジ時間 2,643 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main(){
  int x,y,l;
  cin >> x >> y >> l;
  int ans = 0;
  if(x > 0){
    if(y < 0){
      ans += 2;
    }else{
      ans++;
    }
  }else if(x < 0){
    if(y < 0){
      ans += 2;
    }else{
      ans++;
    }
  }else{
    if(y < 0){
      ans += 2;
    }
  }
  if(y > 0){
    while(y > 0){
      y -= l;
      ans++;
    }
  }else if(y < 0){
    while(y < 0){
      y += l;
      ans++;
    }
  }
  if(x > 0){
    while(x > 0){
      x -= l;
      ans++;
    }
  }else if(x < 0){
    while(x < 0){
      x += l;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
0