結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
![]() |
提出日時 | 2017-11-20 02:36:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 806 bytes |
コンパイル時間 | 704 ms |
コンパイル使用メモリ | 83,932 KB |
実行使用メモリ | 8,576 KB |
最終ジャッジ日時 | 2024-11-26 00:56:46 |
合計ジャッジ時間 | 25,647 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 15 TLE * 4 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<cmath> #include<math.h> #include<iomanip> #include<stdio.h> #include<random> #include<ctime> #include<cstdlib> using namespace std; int main(){ long long int x, y, l, ans=0, move_x=0, move_y=0; cin >> x >> y >> l; if(x==0 && y==0){ cout << 0 << endl; return 0; } else if(x!=0 && y>=0){ ans++; } else if(x==0 && y<0){ ans+=2; } else if(x!=0 && y<0){ ans++; } while(1){ if(x>0){ move_x+=l; ans++; } else if(x<0){ move_x-=l; ans++; } if(move_x>=x){ break; } } while(1){ if(y>0){ move_y+=l; ans++; } else if(y<0){ move_y-=l; ans++; } if(move_y>=y){ break; } } cout << ans << endl; return 0; }