結果
問題 | No.419 直角三角形 |
ユーザー |
![]() |
提出日時 | 2016-09-09 22:34:49 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 592 bytes |
コンパイル時間 | 979 ms |
コンパイル使用メモリ | 68,088 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 10:27:40 |
合計ジャッジ時間 | 1,174 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream>#include <string>#include <algorithm>#include <iomanip>#include <cmath>#include <utility>#include <numeric>using namespace std;#define REP(i, n) for(int i = 0; i < n; i++)#define RREP(i,n) for(int i = (n)-1; i >= 0; i--)#define FOR(i, l, r) for(int i = l; i < r; i++)#define RFOR(i, l,r) for(int i= (l)-1; i>= (r) ; i--)int main(){ios::sync_with_stdio(false);int a, b;cin >> a >> b;if(b < a)swap(a,b);double c = sqrt(b*b - a*a);if(a + c <= b)c = sqrt(b*b + a*a);cout << setprecision(8) << c << '\n';}