結果
| 問題 | 
                            No.48 ロボットの操縦
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hiyori
                         | 
                    
| 提出日時 | 2016-11-12 19:37:50 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 465 bytes | 
| コンパイル時間 | 392 ms | 
| コンパイル使用メモリ | 54,256 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-25 21:28:10 | 
| 合計ジャッジ時間 | 1,077 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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 (y>0 && x!=0) count = 1;
    else if (y<0 && x!=0) count = 2;
    
    if (x < 0) x *= -1;
    if (y < 0) y *= -1;
    
    count += action(y,l)+action(x,l);
    
  cout << count << endl;
  return 0;
}
            
            
            
        
            
hiyori