PAT-乙-1063 1063 计算谱半径 (20 分)

在这里插入图片描述

代码

#include <stdio.h>
#include <math.h>

int main() {

	int n;
	scanf("%d", &n);
	double max = 0;
	for(int i=0; i<n; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		double t = sqrt(a*a+b*b);
		if(t>max){
			max = t;
		}
	}
	printf("%.2lf\n", max);

	return 0;
}

注解

水题

结果

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/zhanggirlzhangboy/article/details/83421450