結果

問題 No.48 ロボットの操縦
コンテスト
ユーザー Xiaoxiao Deng
提出日時 2025-11-11 16:56:13
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 424 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 26,448 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-11-11 16:56:16
合計ジャッジ時間 2,120 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d%d%d", &X, &Y, &L);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

// yukicoder: 48 ロボットの操縦
// 2019.4.7 bal4u
// 初心者向け

#include <stdio.h>

int main()
{
	int X, Y, L, ans;
	scanf("%d%d%d", &X, &Y, &L);
	ans = 0;
	if (X || Y) {
		int x = X, y = Y;
		if (x < 0) x = -x;
		if (x > 0) ans += (x - 1) / L + 1;
		if (y < 0) y = -y;
		if (y > 0) ans += (y - 1) / L + 1;
		if (X == 0 && Y > 0);
		else if (Y >= 0) ans++;
		else ans += 2;
	}
	printf("%d\n", ans);
	return 0;
}
0