結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
prog470
|
| 提出日時 | 2016-09-08 17:02:31 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 639 bytes |
| コンパイル時間 | 592 ms |
| コンパイル使用メモリ | 68,680 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-21 18:54:16 |
| 合計ジャッジ時間 | 1,227 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
using namespace std;
int main() {
int X, Y, L;
cin >> X >> Y >> L;
int cnt = 0;
if (Y >= 0 && X != 0) {
cnt++;
}
else if(Y<0 && X != 0) {
cnt += 2;
}
else if(Y > 0 && X == 0){
//nothing
}
else if(Y < 0 && X == 0){
cnt += 2;
}
/*
cout << "dy: " << (abs(Y) + L - 1)/L << endl;
cout << "dx: " << (abs(X) + L - 1)/L << endl;
*/
cnt += (abs(Y) + L-1 ) / L + (abs(X) + L - 1) / L;
cout << cnt << endl;
return 0;
}
prog470