結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー ree-rishun
提出日時 2020-04-04 05:06:54
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
RE  
実行時間 -
コード長 809 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 214 ms
コンパイル使用メモリ 34,176 KB
最終ジャッジ日時 2026-02-22 05:33:44
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>

int main(){
    // 宣言
    int controlCnt = 0;
    signed int X = 0;
    signed int Y = 0;
    signed int distance = 0;
    
    // 入力値受け取り
    scanf("%d", X);
    scanf("%d", Y);
    scanf("%d", distance);
    
    // X方向
    if(X >= 0){
        controlCnt++;
        controlCnt += X / distance + (X % distance > 0);
        if(Y == 0)
            goto answer;
        
    }else{
        controlCnt += 2;
        controlCnt += -X / distance + (-X % distance > 0);
        if(Y == 0)
            goto answer;
    }
    
    // Y方向
    if(Y > 0)
        controlCnt += Y / distance + (Y % distance > 0);
    else
        controlCnt += -Y / distance + (-Y % distance > 0);
    goto answer;
    
    // 回答表示
answer:
    printf("%d",controlCnt);
    return 0;
}
0