結果
| 問題 |
No.419 直角三角形
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2016-09-12 10:45:42 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 216 bytes |
| コンパイル時間 | 335 ms |
| コンパイル使用メモリ | 23,936 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 03:50:18 |
| 合計ジャッジ時間 | 1,160 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 3 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:19: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
9 | 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);
| ^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main(void) {
int a, b;
double c1, c2;
scanf("%d%d", &a, &b);
c1 = sqrt(a * a + b * b);
c2 = sqrt(abs(a * a - b * b));
printf("%f\n", (c1 < c2) ? c1 : c2);
return 0;
}
suppy193