結果

問題 No.48 ロボットの操縦
ユーザー r2en_
提出日時 2017-07-09 00:08:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 537 ms
コンパイル使用メモリ 67,232 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 20:23:31
合計ジャッジ時間 1,382 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)

int main(){
    int x = 0; cin >> x;
    int y = 0; cin >> y;
    int l = 0; cin >> l;
    int mo = 0;
    int res = 0;

    if(y<0){ y = abs(y); mo = y/l; res=y%l; if(res!=0){ mo+=1; }}
    else if(y>0){ y = abs(y); mo+=1; mo+=y/l; res=y%l; if(res!=0){ mo+=1; }}

    if(x<0){ x = abs(x); mo+=1; mo+=x/l; res=y%l; if(res!=0){ mo+=1; }}
    else if(x>0){ x = abs(x); mo+=1; mo+=x/l; res=y%l; if(res!=0){ mo+=1; }}

    cout << mo << endl;
    return 0;
}
0