結果

問題 No.48 ロボットの操縦
ユーザー kongarishisyamo
提出日時 2016-03-03 22:25:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 394 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 58,884 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 18:35:31
合計ジャッジ時間 1,247 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cmath>

using namespace std;

int main(){

	int X,Y,L;
	int ans=0;

	cin>>X>>Y>>L;

	ans+=(abs(X)/L)+(abs(X)%L!=0)+(abs(Y)/L)+(abs(Y)%L!=0);

	if(X==0&&Y>0) ans+=0;
	if(X==0&&Y==0) ans+=0;
	if(X==0&&Y<0) ans+=2;
	if(X>0&&Y>0) ans+=1;
	if(X>0&&Y==0) ans+=1;
	if(X>0&&Y<0) ans+=2;
	if(X<0&&Y>0) ans+=1;
	if(X<0&&Y==0) ans+=1;
	if(X<0&&Y<0) ans+=2;

	cout<<ans<<endl;
}
0