結果
| 問題 | No.48 ロボットの操縦 |
| コンテスト | |
| ユーザー |
hiyori
|
| 提出日時 | 2017-06-07 12:22:54 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 569 bytes |
| 記録 | |
| コンパイル時間 | 533 ms |
| コンパイル使用メモリ | 65,352 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 12:42:38 |
| 合計ジャッジ時間 | 1,337 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 1 |
ソースコード
#include <iostream>
using namespace std;
int action (int n, int l, int flag)
{
int sum = 0;
if(n==0) { return 0; }
if (flag>0) { sum++; } //向きを変更する動作
sum += n/l;
if (n%l) { sum++; }
return sum;
}
int main ()
{
int x,y,l;
cin >> x >> y >> l;
int cnt = 0;
if (y>0) { // 北向きに移動するとき
cnt += action(y,l,0);
cnt += action(abs(x),l,1);
}
else {
cnt += action(abs(x),l,1);
cnt += action(abs(y),l,1);
}
cout << cnt << endl;
return 0;
}
hiyori