結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             f843nmfwisfeuw
                         | 
                    
| 提出日時 | 2020-07-19 10:35:19 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 3 ms / 5,000 ms | 
| コード長 | 799 bytes | 
| コンパイル時間 | 944 ms | 
| コンパイル使用メモリ | 92,396 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-16 05:39:01 | 
| 合計ジャッジ時間 | 1,899 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 25 | 
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <string>
#include <map>
#include <iterator>
#include <set>
#include <queue>
using namespace std;
int main() {
    long X, Y, L;
    cin >> X >> Y >> L;
    long count = 0;
    // required rotations
    if (Y < 0) {
        count = 2;
    } else {
        if (X == 0) {
            count = 0;
        } else {
            count = 1;
        }
    }
    long absX = abs(X);
    long absY = abs(Y);
    if (absX % L != 0) {
        count += (absX / L + 1);
    } else {
        count += absX / L;
    }
    if (absY % L != 0) {
        count += (absY / L + 1);
    } else {
        count += absY / L;
    }
    cout << count << endl;
    return 0;
}
            
            
            
        
            
f843nmfwisfeuw