結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
tenkyu9
|
| 提出日時 | 2017-11-20 02:37:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 906 bytes |
| コンパイル時間 | 1,231 ms |
| コンパイル使用メモリ | 83,996 KB |
| 実行使用メモリ | 10,024 KB |
| 最終ジャッジ日時 | 2024-11-26 01:00:13 |
| 合計ジャッジ時間 | 27,206 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 WA * 6 TLE * 3 |
ソースコード
#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++;
if(move_x>=x){
break;
}
} else if(x<0){
move_x-=l;
ans++;
if(move_x<=x){
break;
}
}
}
while(1){
if(y>0){
move_y+=l;
ans++;
if(move_y>=y){
break;
}
} else if(y<0){
move_y-=l;
ans++;
if(move_y<=y){
break;
}
}
}
cout << ans << endl;
return 0;
}
tenkyu9