結果

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

ソースコード

diff #

#include<stdio.h>

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

    if(y < 0)
        res += 2;
    if(x != 0)
        res += 1;

    x = (x < 0)?(-1)*x:x;
    y = (y < 0)?(-1)*y:y;

    res += (x%l == 0)?x/l:(x/l)+1;
    res += (y%l == 0)?y/l:(y/l)+1;

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

    return 0;
}
0