結果
| 問題 |
No.419 直角三角形
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-15 22:47:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 320 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 40,116 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 06:15:58 |
| 合計ジャッジ時間 | 1,030 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d%d", &a, &b);
| ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cmath>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
int a, b;
int main(){
scanf("%d%d", &a, &b);
if(a == b){
printf("%.10lf\n", a * M_SQRT2);
return 0;
}
if(a > b){
swap(a, b);
}
printf("%.10lf\n", sqrt(b * b - a * a));
return 0;
}