結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kaito_tateyama
                         | 
                    
| 提出日時 | 2017-08-07 15:09:50 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 531 bytes | 
| コンパイル時間 | 414 ms | 
| コンパイル使用メモリ | 54,700 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-11 22:21:04 | 
| 合計ジャッジ時間 | 1,286 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 7 WA * 18 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:7: warning: ‘xx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    8 |   int xx,yy;
      |       ^~
main.cpp:8:10: warning: ‘yy’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    8 |   int xx,yy;
      |          ^~
            
            ソースコード
#include <iostream>
using namespace std;
int main() {
  int x,y,l,cx,cy,r;
  int xx,yy;
  cin >> x >> y >> l;
  cx = 0;
  cy = 0;
  r = 0;
  //回転r
  if (x == 0) {
    r = 0;
  }else if (y >= 0) {
    r = 1;
  }else if (y < 0){
    r = 2;
  }
  //移動距離cx + cy
  if (x < 0) {
     xx = -x;
  }
  if (y < 0) {
    yy = -y;
  }
  if (xx % l == 0) {
    cx = xx / l;
  }else{
    cx = xx / l + 1;
  }
  if (yy % l == 0) {
    cy = yy / l;
  }else{
    cy = yy / l + 1;
  }
  cout << cx + cy + r << "\n";
  return 0;
}
            
            
            
        
            
kaito_tateyama