結果

問題 No.48 ロボットの操縦
ユーザー siguma323
提出日時 2016-05-05 11:35:18
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 672 bytes
コンパイル時間 662 ms
コンパイル使用メモリ 84,844 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 18:39:08
合計ジャッジ時間 1,367 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <iostream>
#include <queue>
#include <utility>
#include <cmath>
#include <map>
#include <unordered_map>
#include <functional>
#include <fstream>
using namespace std;

using ull = unsigned long long;

int main()
{
    int x,y,l;
    cin >> x >> y >> l;

    int num = abs(x/l) + abs(y/l);
    if(x !=0)
    {
        ++num;
        if(x % l != 0)
            ++num;
    }
    if(y > 0)
    {
        if(y % l != 0)
            ++num;
    }

    if(y < 0)
    {
        if(x ==0)
            ++num;
        ++num;
        if(y % l !=0)
            ++num;
    }

    cout << num << endl;
}
0