結果

問題 No.48 ロボットの操縦
ユーザー githide3
提出日時 2018-07-25 20:29:56
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 1,201 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 01:08:28
合計ジャッジ時間 2,046 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include    <stdio.h>

int main(void)
{
    int X, Y, L;
    int nx, ny, nr;

    scanf("%d", &X);
    scanf("%d", &Y);
    scanf("%d", &L);

    if (X < 0) {
        X = -X;
    }
    if (Y < 0) {
        Y = -Y;
    }
    nx = X / L + ((X % L) ? 1 : 0);
    ny = Y / L + ((Y % L) ? 1 : 0);

    if (Y < 0) {
        nr = 2;
    } else if (X) {
        nr = 1;
    } else {
        nr = 0;
    }

    printf("%d\n", nx + ny + nr);
    return 0;
}
0