problemscpp
A collection of my answers to algorithm problems in c++.
函数
pat::b::b1063 命名空间参考

1063 计算谱半径 更多...

函数

int main (istream &cin, ostream &cout)
 
 TEST (b1063, case1)
 

详细描述

1063 计算谱半径

函数说明

◆ main()

int pat::b::b1063::main ( istream &  cin,
ostream &  cout 
)

在文件 pat.cpp2198 行定义.

2198 {
2199 int n;
2200 cin >> n;
2201 double ans = 0;
2202 while(n-- != 0) {
2203 int a;
2204 int b;
2205 cin >> a >> b;
2206 ans = max(ans, sqrt(a * a + b * b));
2207 }
2208 cout << fixed << setprecision(2) << ans;
2209 return 0;
2210 }

被这些函数引用 TEST().

◆ TEST()

pat::b::b1063::TEST ( b1063  ,
case1   
)

在文件 pat_test.cpp978 行定义.

978 {
979 istringstream in("5\n"
980 "0 1\n"
981 "2 0\n"
982 "-1 0\n"
983 "3 3\n"
984 "0 -3");
985 auto out = ostringstream();
986 main(in, out);
987 const auto ans = out.str();
988 ASSERT_EQ("4.24", out.str());
989 }
int main(int argc, char **argv)
Definition: main.cpp:5

引用了 main().