結果

問題 No.48 ロボットの操縦
ユーザー streingmuststreingmust
提出日時 2018-03-25 09:38:16
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 05:27:55
合計ジャッジ時間 967 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main()
{
	long X,Y,L;
	scanf("%d%d%d",&X,&Y,&L);
	if(X==0){
		if(Y==0){
		printf("0\n");
		}
		else if(Y>0){
			printf("%d\n",(Y-1)/L+1);
		}
		else{
			printf("%d\n",(-Y-1)/L+3);
		}
	}
	else{
		if(Y==0){
			printf("%d\n",(X>0?X-1:-X-1)/L+2);
		}
		else if(Y>0){
			printf("%d\n",(X>0?X-1:-X-1)/L+(Y-1)/L+3);
		}
		else{
			printf("%d\n",(X>0?X-1:-X-1)/L+(-Y-1)/L+5);			
		}
	}
	return 0;
}
0