結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
![]() |
提出日時 | 2016-11-12 19:24:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 619 bytes |
コンパイル時間 | 1,096 ms |
コンパイル使用メモリ | 54,364 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-25 21:27:34 |
合計ジャッジ時間 | 1,386 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 21 |
ソースコード
#include <iostream> using namespace std; int action (int num, int l) { int count = 0; if (num >= l) { count += num/l; num = num % l; } count += num; return count; } int main () { int x, y, l; cin >> x >> y >> l; int count = 0; // 行動をカウントする if (x < 0) x *= -1; if (y > 0) { count += action(y, l); if(x) { count++; count += action(x,l); } } else if (y < 0){ if(x) { count++; count += action(x,l); } count++; count += action(y*-1,l); } cout << count << endl; return 0; }