PAT (Basic Level) 1063 计算谱半径

题意

计算谱半径。

思路

水~

代码

#include <bits/stdc++.h>
using namespace std;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n;
	cin >> n;
	double ans  = 0;
	for (int i = 0; i < n; ++i) {
		int a, b;
		cin >> a >> b;
		ans = max(ans, sqrt(1.0 * a * a + b * b));
	}
	cout << fixed << setprecision(2) << ans << '\n';
	return 0;
} 

HINT

不定时更新更多题解,Basic Level 全部AC代码,详见 link ! ! !

发布了71 篇原创文章 · 获赞 15 · 访问量 3243

猜你喜欢

转载自blog.csdn.net/abcdefbrhdb/article/details/104638863