結果

問題 No.48 ロボットの操縦
ユーザー pracode
提出日時 2018-09-17 21:57:26
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 660 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 28,672 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 07:50:49
合計ジャッジ時間 733 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int inscal(int x,int y,int l);
int main()
{
    int x,y,l;
    int instruction=0;
    int absx,absy;
    
    scanf("%d%d%d",&x,&y,&l);
    
    absx=abs(x);
    absy=abs(y);
    
    instruction=inscal(absx,absy,l);
    if(y>=0){
        instruction++;
    }
    else{
        instruction+=2;
    }
    printf("%d\n",instruction);
    return 0;
}

int inscal(int x,int y,int l)
{
    int instruction=0;
    if(x%l==0){
        instruction+=x/l;
    }
    else{
        instruction+=x/l+1;
    }
      
    if(y%l==0){
        instruction+=y/l;
    }
    else{
        instruction+=y/l+1;
    }
    return instruction;
}
0