結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-07-16 07:08:00 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 548 bytes | 
| コンパイル時間 | 495 ms | 
| コンパイル使用メモリ | 63,104 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-24 00:03:38 | 
| 合計ジャッジ時間 | 1,411 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 | 
ソースコード
#include <iostream>
using namespace std;
int main() {
  int x, y, l;
  int cnt = 0;
  cin >> x >> y >> l;
  if (x!=0 || y!=0){
    if (y < 0) {
      cnt = 2;
    } else {
      if (x == 0){
        cnt = 0;
      } else {
        cnt = 1;
      }
    }
    if (x < 0) {
      x *= -1;
    }
    if (y < 0) {
      y *= -1;
    }
    if ((x%l) == 0){
      cnt += (x/l);
    } else {
      cnt += ((x/l) + 1);
    }
    if ((y%l) == 0){
      cnt += (y/l);
    } else {
      cnt += ((y/l) + 1);
    }
  }
  cout << cnt << endl;
  return 0;
}