結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー rodea
提出日時 2017-09-29 14:09:13
言語 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
結果
AC  
実行時間 946 ms / 5,000 ms
コード長 495 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 122 ms
コンパイル使用メモリ 38,084 KB
最終ジャッジ日時 2026-02-22 00:16:38
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<stdio.h>

int main(void)
{
	int X, Y, L, i = 0, j = 0, a=0;

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

	if (X < 0)
	{
		X = -X;
	}

	if (Y < 0)
	{
		Y = -Y;

		a = 1;
	}

	while (X - L*i > 0)
	{
		i++;
	}

	while (Y - L*j > 0)
	{
		j++;
	}

	if (X==0)
	{
		if (a == 0)
		{
			printf("%d", j);
		}

		if (a == 1)
		{
			printf("%d", j + 2);
		}
	}

	else
	{
		if (a == 0)
		{
			printf("%d", i + j + 1);
		}

		if(a==1)
		{
			printf("%d", i + j + 2);
		}

	}

	return 0;

}
0