結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー Mcpu3
提出日時 2018-05-01 23:30:01
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 274 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 57 ms
コンパイル使用メモリ 38,400 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-21 20:19:21
合計ジャッジ時間 1,423 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:8:13: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
    8 |         t = abs(x) + abs(y);
      |             ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 

ソースコード

diff #
raw source code

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

int main(void)
{
	int x, y, l, s = 0, t;
	scanf("%d\n%d\n%d", &x, &y, &l);
	t = abs(x) + abs(y);
	x != 0 ? s++ : 0;
	y < 0 && x != 0 ? s++ : y < 0 ? s += 2 : 0;
	s += t / l;
	t%l ? s++ : 0;
	printf("%d\n", s);
	return 0;
}
0