PAT B1063 计算谱半径 (20 分)

在这里插入图片描述
大水题,开始题目看到谱半径还以为是什么难东西,结果这代码量。。。

#include <cstdio>
#include <cmath>

int main(){
    
    
	int n;
	scanf("%d", &n);
	int a, b;
	double max = -1;
	for(int i=0; i<n; i++){
    
    
		scanf("%d %d", &a, &b);
		double res = sqrt(1.0*a*a+b*b);
		if(res > max){
    
    
			max = res;
		}
	}
	printf("%.2f", max);
	
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/weixin_45964844/article/details/113756960