結果

問題 No.48 ロボットの操縦
ユーザー かぼちゃかぼちゃ
提出日時 2018-04-08 13:02:05
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 407 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 63,516 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 20:19:38
合計ジャッジ時間 1,393 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>

#define ALL(x) (x).begin(),(x).end()

using namespace std;
int main(){
    int x,y,l,ans = 0;
    cin >> x >> y >> l;
    if(y < 0)ans += 2;
    else if(x != 0)ans++;
    x = x < 0 ? -x : x;
    y = y < 0 ? -y : y;
    ans += y%l != 0 ? 1 + y/l : y/l;
    ans += x%l != 0 ? 1 + x/l : x/l;
    cout << ans << endl;
    return 0;
}
0