結果
| 問題 |
No.419 直角三角形
|
| コンテスト | |
| ユーザー |
gotutiyan
|
| 提出日時 | 2018-08-02 10:30:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 701 bytes |
| コンパイル時間 | 703 ms |
| コンパイル使用メモリ | 94,524 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 17:04:57 |
| 合計ジャッジ時間 | 1,391 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <limits>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define all(v) ((v).begin(),(v).end())
#define Sort(v) sort(all(v))
#define INF 1000000000
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int a,b;
cin>>a>>b;
//a^2+b^2=c^2
//b^2=c^2-a^2
double ans=0;
ans=sqrt(a*a+b*b);
if(a<b)swap(a,b);
if(a!=b)ans=min(ans,sqrt(a*a-b*b));
cout<<fixed<<setprecision(10);
cout<<ans<<endl;
}
gotutiyan