結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2020-07-29 06:23:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 539 bytes |
コンパイル時間 | 587 ms |
コンパイル使用メモリ | 73,920 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-28 21:19:35 |
合計ジャッジ時間 | 1,383 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <iostream> //cin, cout#include <vector> //vector#include <algorithm> //sort,min,max#include <string> //string#include <ios> //fixed#include <iomanip> //setprecision#include <utility> //swap#include <cstdlib> //abs(int)using namespace std;int main() {int X, Y, L;cin >> X >> Y >> L;if (X == 0 && Y == 0) {cout << 0 << endl;return 0;}int ans = ((abs(X) + L - 1) / L) + ((abs(Y) + L - 1) / L);if (Y < 0) {ans += 2;}else {if (X != 0) {ans++;}}cout << ans << endl;return 0;}