結果
問題 | No.48 ロボットの操縦 |
ユーザー | ut0s |
提出日時 | 2019-09-10 19:53:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 520 bytes |
コンパイル時間 | 1,568 ms |
コンパイル使用メモリ | 165,764 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 16:19:14 |
合計ジャッジ時間 | 2,446 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
/** @file 048.cpp @title No.48 ロボットの操縦 - yukicoder @url https://yukicoder.me/problems/no/48 **/ #include <bits/stdc++.h> using namespace std; typedef long long LL; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, N) for (int i = 0; i < (N); ++i) int main() { LL X, Y, L; cin >> X >> Y >> L; LL ans; ans = ceil((abs(X) + L - 1) / L) + ((abs(Y) + L - 1) / L); if (Y >= 0 && X != 0) { ans += 1; } else if (Y < 0) { ans += 2; } cout << ans << endl; return 0; }