結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー vjudge1
提出日時 2026-11-23 17:48:58
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 1,256 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 389 ms
コンパイル使用メモリ 84,068 KB
実行使用メモリ 9,860 KB
最終ジャッジ日時 2026-11-23 17:49:01
合計ジャッジ時間 2,753 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge6_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
using namespace std;

int mod(int x, int y)
{
    if (x-y>0)
    {
        return x-y;
    }
    else 
    {
        return y-x;
    }
}

int main()
{
    int x,y,l;
    cin >> x;
    cin >> y;
    cin >> l;
    int ans = 0;
    if(y>0)
    {
        if(x>0)
        {
            ans++;
            ans = ans + (x/l + x%l) + (y/l + y%l);
        }
        else if(x == 0)
        {
            ans= ans + (y/l + y%l);
        }
        else if(x < 0)
        {
            ans++;
            ans = ans - (x/l + x%l) + (y/l + y%l);

        }
    }
    else if(y < 0)
    {
        if(x>0)
        {
            ans++;
            ans++;
            ans = ans + (x/l + x%l) - (y/l + y%l);
        }
        else if(x == 0)
        {
            ans++;
            ans++;
            ans= ans - (y/l + y%l);
        }
        else if(x < 0)
        {
            ans++;
            ans++;
    
            ans = ans - (x/l + x%l) - (y/l + y%l);

        }
    }
    else if( y==0)
    {
        if(x>0)
        {
            ans++;
            ans = ans + (x/l + x%l) ;
        }
        
        else if(x < 0)
        {
            ans++;
        
    
            ans = ans - (x/l + x%l);

        }

    }
    cout << ans << endl;
}
0