結果

問題 No.48 ロボットの操縦
ユーザー kknkn
提出日時 2018-07-12 18:56:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 365 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 54,492 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-02 13:07:31
合計ジャッジ時間 1,318 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main(){
    int x,y,k;
    //x:東西
    //y:北南
    cin >> x >> y >> k;
    int ans = 0;
    if(x != 0)ans += 1;
    if(x != 0 && y < 0)ans += 1;
    if(x == 0 && y < 0)ans += 2;
    ans += abs(y)/k;
    ans += abs(x)/k;
    if(y%k != 0)ans += 1;
    if(x%k != 0)ans += 1;
    cout << ans << endl;
    return 0;
}
0