結果

問題 No.48 ロボットの操縦
ユーザー ococonomy1
提出日時 2018-09-07 16:53:08
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 29,056 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-27 21:23:17
合計ジャッジ時間 2,225 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void) {
  int x,y,l,count = 0,robX = 0,robY = 0;
  scanf("%d",&x); scanf("%d",&y); scanf("%d",&l);

  if(y >= 0){
    while(1){
      if(robY >= y)break;
      robY += l;
      count++;
    }
    if(x != 0)count++;
    if(x < 0)x *= -1;
    while(1){
      if(robX >= x)break;
      robX += l;
      count++;
    }
  }

  else{
    if(x < 0)x *= -1;
    if(x != 0)count++;
    while(1){
      if(robX >= x)break;
      robX += l;
      count++;
    }
    count++;
    while(1){
      if(robY <= y)break;
      robY -= l;
      count++;
    }
  }

  printf("%d\n",count);
  return 0;
}
0