1063 计算谱半径 (20 分)

  • 2019 年 10 月 30 日
  • 筆記

1063 计算谱半径 (20 分)

【我的代码】

#include <iostream>  #include <math.h>  using namespace std;  int main(){      int N;      scanf("%d",&N);      float max = 0;      for(int i = 0; i < N; i++){          int a, b;          scanf("%d %d",&a, &b);          float tmp = sqrt((float)(a*a) + (float)(b*b));          if(tmp > max)              max = tmp;      }      printf("%.2f", max);      return 0;  }  

【思路】

实际上就是一个计算最大值的过程,这里不多说了。