結果
問題 | No.419 直角三角形 |
ユーザー | suppy193 |
提出日時 | 2016-09-12 10:47:43 |
言語 | C90 (gcc 11.4.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 287 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 23,424 KB |
最終ジャッジ日時 | 2024-04-28 12:23:46 |
合計ジャッジ時間 | 537 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function ‘main’: main.c:13:27: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration] 13 | c2 = sqrt(abs(a * a - b * b)); | ^~~ main.c:3:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’ 2 | #include <math.h> +++ |+#include <stdlib.h> 3 | main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d%d", &a, &b); | ^~~~~~~~~~~~~~~~~~~~~ /usr/bin/ld: /tmp/ccWq4PL3.o: in function `main': main.c:(.text.startup+0x52): undefined reference to `sqrt' /usr/bin/ld: main.c:(.text.startup+0x70): undefined reference to `sqrt' /usr/bin/ld: main.c:(.text.startup+0xbf): undefined reference to `sqrt' collect2: error: ld returned 1 exit status
ソースコード
#include <stdio.h> #include <math.h> int main(void) { int a, b; double c1, c2; scanf("%d%d", &a, &b); if(a == b){ printf("%f\n", sqrt(a * a + b * b)); } else { c1 = sqrt(a * a + b * b); c2 = sqrt(abs(a * a - b * b)); printf("%f\n", (c1 < c2) ? c1 : c2); } return 0; }