結果
問題 | No.48 ロボットの操縦 |
ユーザー |
![]() |
提出日時 | 2020-11-22 16:42:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 2,959 ms |
コンパイル使用メモリ | 192,388 KB |
最終ジャッジ日時 | 2025-01-16 04:25:53 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int X,Y,L;cin>>X>>Y>>L;int cnt=0;if(X==0 && Y==0){cout<<0<<endl;return 0;}//方向転換回数の加算if(Y>0 && X !=0){cnt++;}if(Y<0){cnt+=2;}if(Y==0) cnt++;//縦横移動回数//cout<<abs(X)<<" "<<abs(Y)<<" "<<L<<endl;cnt+=((abs(X)+L-1)/L);cnt+=((abs(Y)+L-1)/L);cout<<cnt<<endl;return 0;}