結果

問題 No.48 ロボットの操縦
ユーザー lrf141
提出日時 2016-12-03 23:10:43
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 380 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 23,936 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-27 14:37:49
合計ジャッジ時間 1,173 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d %d %d",&x,&y,&l);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<math.h>

int main(){
    int x,y,l;
    scanf("%d %d %d",&x,&y,&l);
    int res = 0;

    if((0 < x && 0 < y) || (x < 0 && 0 <= y)){
        res++;
    }
    else if((x < 0 && y <= 0) || (x <= 0 && y < 0)){
        res+=2;
    }

    res += (int)ceil(fabs((double)x)/l);
    res += (int)ceil(fabs((double)y)/l);

    printf("%d\n",res);

    return 0;
}
0