結果

問題 No.48 ロボットの操縦
ユーザー omuomu
提出日時 2015-11-23 14:47:40
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 617 ms
コンパイル使用メモリ 70,508 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-21 18:30:45
合計ジャッジ時間 1,385 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <map>
#include <cmath>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;

int main(){
	ll x,y,l;
	cin >> x >> y >> l;
	ll ans = 0;
	int dir = 0;
	if(y > 0)ans+=ceil(double(abs(y))/l);
	if(x)ans+=ceil(double(abs(x))/l)+1,dir = 1;
	if(y < 0)ans+=ceil(double(abs(y))/l),ans+= 2-dir;
	
	cout << ans << endl;
}
0