結果

問題 No.48 ロボットの操縦
ユーザー Mcpu3Mcpu3
提出日時 2018-05-01 23:30:01
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 28,752 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-10 08:48:10
合計ジャッジ時間 1,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 0 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 0 ms
4,380 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:8:13: 警告: 関数 ‘abs’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    8 |         t = abs(x) + abs(y);
      |             ^~~
main.c:3:1: 備考: include ‘<stdlib.h>’ or provide a declaration of ‘abs’
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 

ソースコード

diff #

#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