結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
👑 |
提出日時 | 2022-08-08 10:43:58 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 5,000 ms |
コード長 | 604 bytes |
コンパイル時間 | 652 ms |
コンパイル使用メモリ | 70,692 KB |
最終ジャッジ日時 | 2025-01-30 19:24:58 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <iostream> #include <list> #include <vector> #include <string> #include <stdio.h> #include <stdint.h> using namespace std; using uint = unsigned int; using ll = long long; inline ll CountStep( const ll& D , const ll& L ) { return D >= 0 ? D / L + ( D % L == 0 ? 0 : 1 ) : CountStep( - D , L );} int main() { ll X; cin >> X; ll Y; cin >> Y; ll L; cin >> L; ll step; if( Y >= 0 ){ step = CountStep( Y , L ) + ( X == 0 ? 0 : 1 + CountStep( X , L ) ); } else { step = 1 + CountStep( X , L ) + 1 + CountStep( Y , L ); } cout << step << endl; return 0; }