結果

問題 No.48 ロボットの操縦
ユーザー Elizack
提出日時 2020-02-05 18:51:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 64,372 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 20:13:53
合計ジャッジ時間 2,461 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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++;
    }
  }
  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