結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
nenuon
|
| 提出日時 | 2017-02-27 22:05:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 840 bytes |
| コンパイル時間 | 800 ms |
| コンパイル使用メモリ | 77,768 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 19:54:56 |
| 合計ジャッジ時間 | 1,396 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define ll long long
#define PI acos(-1.0)
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
ll int llabs(int x){
return x<0 ? -x:x;
}
int main(){
ll int x, y, L;
cin >> x >> y >> L;
if(x==0 && y==0){
cout << 0 << endl;
return 0;
}
int ans = 0;
ans += llabs(x) / L;
if(x%L!=0) ans++;
ans += llabs(y) / L;
if(y%L!=0) ans++;
//x,yの方角によって回転動作が何回必要か調べる必要がある
if(y>=0 && x!=0) ans++;
else if(y<0) ans += 2;
cout << ans << endl;
}
nenuon