結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
tenkyu9
|
| 提出日時 | 2017-11-20 02:35:26 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 796 bytes |
| コンパイル時間 | 666 ms |
| コンパイル使用メモリ | 85,060 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-26 00:55:57 |
| 合計ジャッジ時間 | 1,616 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 18 |
ソースコード
#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(){
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;
}
tenkyu9