結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー ree-rishun
提出日時 2020-04-04 05:11:44
言語 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
結果
WA  
実行時間 -
コード長 669 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 172 ms
コンパイル使用メモリ 37,824 KB
最終ジャッジ日時 2026-02-22 05:33:45
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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 (Y >= 0) {
		controlCnt += Y / distance + (Y % distance > 0);
		if (X == 0)
			goto answer;

	}
	else {
		controlCnt ++;
		controlCnt += -Y / distance + (-Y % distance > 0);
		if (X == 0)
			goto answer;
	}

	// Y方向
	controlCnt++;
	if (X > 0)
		controlCnt += X / distance + (X % distance > 0);
	else
		controlCnt += -X / distance + (-X % distance > 0);
	goto answer;

	// 回答表示
answer:
	printf("%d", controlCnt);
	return 0;
}
0