結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー neeet
提出日時 2017-06-15 22:45:33
言語 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 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 427 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 185 ms
コンパイル使用メモリ 37,952 KB
最終ジャッジ日時 2026-02-21 23:54:02
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main(void)
{
  long x, y, l, step = 0, i;

  scanf("%ld%ld%ld", &x, &y, &l);

  // 回転
  if(y < 0){
    step++;
    if(x == 0)
      step++;
  }
  if(x)
    step++;
//  printf("%ld\n", step);

  // 前進
  if(x < 0)
    x -= (x << 1);
  step += x / l + x % l;
  if(y < 0)
    y -= (y << 1);
  step += y / l + y % l;

//  printf("y = %ld\n", y);
//  printf("x = %ld\n", x);
  printf("%ld\n", step);
}
0