結果
問題 | No.419 直角三角形 |
ユーザー |
![]() |
提出日時 | 2016-09-09 22:33:24 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 1,020 bytes |
コンパイル時間 | 912 ms |
コンパイル使用メモリ | 84,672 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-16 10:27:28 |
合計ジャッジ時間 | 1,567 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <algorithm>#include <utility>#include <functional>#include <cstring>#include <queue>#include <stack>#include <math.h>#include <iterator>#include <vector>#include <string>#include <set>#include <math.h>#include <iostream>#include<map>#include <iomanip>#include <stdlib.h>#include <list>#include <typeinfo>#include <list>#include <set>using namespace std;#define MAX_MOD 1000000007#define REP(i,n) for(int i = 0;i < n;++i)#define LONGINF 1000000000000000000int main() {double a[2];cin >> a[0] >> a[1];if (a[0] < a[1]) swap(a[0], a[1]);double top = a[0], bot = 0;a[0] *= a[0];a[1] *= a[1];for (int i = 0;i < 100000;++i) {double mid = (top + bot) / 2;double hoge = mid;mid *= mid;if (a[1] + mid < a[0]) {bot = hoge;}else {top = hoge;}}if (a[0] != a[1]) {cout << fixed << setprecision(30) << bot;}else {cout << fixed << setprecision(30) << sqrt(a[0] + a[1]) << endl;}return 0;}