結果

問題 No.48 ロボットの操縦
ユーザー Maeda
提出日時 2025-03-07 10:22:20
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 24,960 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-07 10:22:22
合計ジャッジ時間 2,067 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdbool.h>

void main(){
	//X座標
	int x = 0,y = 0,l = 0;
	int input = scanf("%d\n%d\n%d\n",&x,&y,&l);
	if(input == 2){
		printf("入力ミス\n");
	}
	//printf("(%d,%d) 移動距離:%d\n",x,y,l);

	//命令回数
	int instructionCount = 0;
	//現在位置
	int trueX = 0 , trueY = 0;
	if( y < 0){
		instructionCount += 2;
		y *= -1;
	}else if(x != 0){
		instructionCount += 1;
		if(x < 0){
			x *= -1;
		}
	}

	while(x > 0 || y > 0){
		if(y >= 0){
			y -= l;
			instructionCount ++;
		}
		if(x >= 0){
			x -= l;
			instructionCount ++;
		}
	}
	printf("%d\n",instructionCount);
}
0