結果

問題 No.172 UFOを捕まえろ
ユーザー suppy193suppy193
提出日時 2015-05-28 11:01:01
言語 C90
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 263 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 23,552 KB
最終ジャッジ日時 2024-04-23 14:04:27
合計ジャッジ時間 704 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:13: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
    8 |         x = abs(x);
      |             ^~~
main.c:3:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’
    2 | #include <math.h>
  +++ |+#include <stdlib.h>
    3 | 
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d%d%d", &x, &y, &r);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccqXxzCQ.o: in function `main':
main.c:(.text.startup+0xeb): undefined reference to `sqrt'
collect2: error: ld returned 1 exit status

ソースコード

diff #

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

int main(void) {
	int x, y, r, tmp;
	scanf("%d%d%d", &x, &y, &r);

	x = abs(x);
	y = abs(y);
	if(x < y){
		tmp = x;
		x = y;
		y = tmp;
	}
	printf("%d\n", (int)((sqrt(y * y * 2) + r) / sqrt(2) * 2 + x - y + 1));
	return 0;
}
0