Language: C++

//二次元幾何ライブラリ
#include <iostream>
#include <cstdio>
#include <complex>
#include <map>
#include <vector>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define ML make_pair 
typedef long double D;
typedef bool B;
typedef complex<D> P;   //点
typedef complex<D> V;   //ベクトル
typedef pair<P,P>  L;   //直線
typedef pair<P,D>  C;   //円
typedef vector<P>  Pol; //多角形

//変数名定義
const D INF = 1e100;
const D EPS = 1e-8;
const D PI = acos(-1);

template<class T> bool operator==(T a, T b){return abs(a - b )< EPS;}
template<class T> int sig(T r) {return (r==0||r==-0) ? 0 : r > 0 ? 1 : -1;}



// ベクトルaの絶対値を求める
// D Length = abs(a);

// 2点a,b間の距離を求める
// D Distance = abs(a-b); 

// 内積 (Inner Product) : a・b = |a||b|cosθ
D IP(V a, V b) {
	return (a.real() * b.real() + a.imag() * b.imag());
}

// 外積 (Exterior Product) : |a×b| = |a||b|sinθ 
D EP(V a, V b) {
	return (a.real() * b.imag() - a.imag() * b.real());
}


// 点の進行方向について
int ccw(P a, P b, P c) {              //点aと点bが与えられた問いに
  b -= a; c -= a;
  if (EP(b, c) > 0)   return +1;      // counter clockwise
  if (EP(b, c) < 0)   return -1;      // clockwise
  if (IP(b, c) < 0)     return +2;    // c--a--b on line
  if (norm(b) < norm(c)) return -2;   // a--b--c on line
  return 0;                           // a--c--b on line  aとbの線分判定はこれ
}


// 2直線の垂直判定 : a⊥b <=> IP(a, b) = 0
B IsVecular(L l1, L l2) {
	return IP(l1.first-l1.second, l2.first-l2.second)==0.0;
}

// 2直線の平行判定 : a//b <=> EP(a, b) = 0
B IsParallel(L l1, L l2) {
	return EP(l1.first-l1.second, l2.first-l2.second)== 0.0;
}

// 2線分の交差判定 
B IIS(L l1, L l2) {
  return ( EP(l1.second-l1.first, l2.first-l1.first) * EP(l1.second-l1.first, l2.second-l1.first) < EPS ) &&
         ( EP(l2.second-l2.first, l1.first-l2.first) * EP(l2.second-l2.first, l1.second-l2.first) < EPS );
}

// 符号付き点と直線の距離 (Distance of Point and Line)  //lの構造 x座標 first<second y座標 first<second 左上 正 右下 負 一致 0
D  DPL(P p,L l){
	V v1=(l.second-l.first);
	V v2=(p-l.first);
	return EP(v1,v2)/abs(v1);
}

// 点と線分の距離 (Distance of Point and Segment)  //lの構造 x座標 first<second y座標 first < second 
D  DPS(P p,L l){
	V v1,v2,v3;
	v1=l.second-l.first;
	v2=p-l.first;
	v3=p-l.second;
	if(IP (v1,v2) <0)
		return abs(p-l.first);
	else if(IP(-v1,v3)<0)
		return abs(p-l.second);
	else
		return abs(DPL(p,l));
}

// 線分と線分の距離 (Distance of Segment and Segment)  //lの構造 x座標 first<second y座標 first < second 
D DSS(L l1,L l2){
	if(IIS(l1,l2))
		return 0;
	else{
		D tem,tem1,tem2;
		tem1=min(DPS(l1.first,l2),DPS(l1.second,l2));
		tem2=min(DPS(l2.first,l1),DPS(l2.second,l1));
		return	min(tem1,tem2);
	}
}

// 三角形の領域判定 Teritory of Triangle 1が内部 0が境界と外部
B TT(P p1,P p2,P p3,P p){
	L l1,l2,l3;
	l1=make_pair(p2,p3);
	l2=make_pair(p3,p1);
	l3=make_pair(p1,p2);

	if(sig(DPL(p1,l1))!=sig(DPL(p,l1)))
		return false;
	else if(sig(DPL(p2,l2))!=sig(DPL(p,l2)))
		return false;
	else if(sig(DPL(p3,l3))!=sig(DPL(p,l3)))
		return false;
	else
		return true;
}

//変数名 = 型 代入したいもの
//example : v1 = V(5.0,-3.0) p1=P(0.0,4.0)
int main(void){
	while(true){
	int N;
		cin >>N; 
	if(!N)
		break;
	D Block[50][2][2];
	D h[50];
	P root1,root2;
	L root;
	D r;
	D rmin=INF;
		cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
	rep(i,N)
		cin >>Block[i][0][0] >>Block[i][0][1] >> Block[i][1][0] >> Block[i][1][1] >>h[i] ;
	root=ML(root1,root2);
	rep(i,N){
			D tem,tem1,tem2;
			P p1,p2,p3,p4;
			p1=P(Block[i][0][0],Block[i][0][1]);
			p2=P(Block[i][1][0],Block[i][0][1]);
			p3=P(Block[i][1][0],Block[i][1][1]);
			p4=P(Block[i][0][0],Block[i][1][1]);
			L la,lb,lc,ld;
			la=ML(p1,p2);
			lb=ML(p2,p3);
			lc=ML(p3,p4);
			ld=ML(p4,p1);
			if(p1.real()<root1.real()&&root1.real()<p3.real()&&p1.imag()<root1.imag()&&root1.imag()<p3.imag())
				tem=0;
			else {
				tem1=min(DSS(root,la),DSS(root,lb));
				tem2=min(DSS(root,lc),DSS(root,ld));
				tem=min(tem1,tem2);
			}
			if(tem<=h[i])
				r=tem;
			else
				r=(h[i]+tem*tem/h[i])/2.0;
			if(rmin > r)
				rmin=r;
	}
    cout << fixed << rmin << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:138:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'long double')
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                 ~~~ ^~ ~~~~~~~~~~~~
      |                 |                |
      |                 |                long double
      |                 std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
                 from a.cc:2:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  223 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:223:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  227 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:227:7: note:   conversion of argument 1 would be ill-formed:
a.cc:138:34: error: cannot bind non-const lvalue reference of type 'long double&' to an rvalue of type 'long double'
  138 |                 cin >> root1.real() >> root1.imag() >> root2.real() >> root2.imag();
      |                        ~~~~~~~~~~^~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:25: note:   no known conversion for argument 1 from 'long double' to 'void*&'
  328 |       operator>>(void*& __p)
      |                  ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:122:36: note:   no known conversion for argument 1 from 'long double' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
  12