当前位置:网站首页>PAT B1063
PAT B1063
2022-06-25 19:57:00 【Madness makes freedom】
1063 Calculate the spectral radius (20 branch )
In mathematics , Matrix “ Spectral radius ” Is the supremum of the modular set of its eigenvalues . In other words , For a given n Eigenvalues of a complex space { a1+b1i,⋯,an+bni }, Their modules are the square of the sum of squares of real and imaginary parts , and “ Spectral radius ” Is the maximum module .
Now let's give some eigenvalues of complex space , Please calculate and output the spectral radius of these eigenvalues .
Input format :
Enter the first line to give a positive integer N(≤ 10 000) Is the number of input eigenvalues . And then N That's ok , Each line gives 1 The real and imaginary parts of eigenvalues , Separated by spaces . Be careful : The problem is to ensure that both the real part and the imaginary part are absolute values that do not exceed 1000 The integer of .
Output format :
Output the spectral radius in one line , Round to decimal 2 position .
sample input :
5
0 1
2 0
-1 0
3 3
0 -3
sample output :
4.24The topic is clearly understood , It should be done by lifting the key , But unfortunately , The definition of spectral radius is not clear to me . It's hard !!
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int main()
{
int n,a,b,sum_squ=0;
cin >> n;
while(n--)
{
cin >> a >> b;
sum_squ=max(sum_squ,a*a+b*b);
}
double sqr=sqrt(sum_squ*1.0);
printf("%.2f\n",sqr);
return 0;
}
边栏推荐
- Tcp/ip test questions (II)
- ActiveMQ--CVE-2016-3088
- PAT B1081
- Is CICC wealth safe? How long does it take to open an account
- Android Development Notes - Quick Start (from sqllite to room licentiousness) 2
- Is it safe to open a new bond? Is low commission reliable
- Applet multi image to Base64 upload
- Vulnhub range the planes: mercury
- From now on, I will blog my code
- Solidity contract address to wallet, wallet address to contract
猜你喜欢

ECS 7-day practical training camp (Advanced route) -- day03 -- ecs+slb load balancing practice

One night I worked as an XPath Terminator: XPath Helper Plus

Web components - Basics

DARKHOLE 2

ECS 7-day practical training camp (Advanced route) -- day01 -- setting up FTP service based on ECS

Applet password input box

How to understand var = a = b = C = 9? How to pre parse?

Wechat applet connects to the server to display mqtt data information

Wechat applet swiper simple local picture display appears large blank

Trend ea- fixed stop loss and profit per order
随机推荐
ECS 7-day practical training camp (Advanced route) -- day01 -- setting up FTP service based on ECS
Vulnhub range - the planes:venus
The meanings of /32, /48, /64 in IPv6 addresses
Life cycle function of composite API
Error record: preg_ match(): Compilation failed: range out of order in character class at offset 13
Google cloud SSH enable root password login
2020-12-09 laravel . Env file loading mechanism process
ActiveMQ--CVE-2016-3088
Network security detection and prevention exercises (III)
Ali visual AI training camp -day05- creativity day - your image recognition project
请问通达信开户安全吗?
SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?
PAT B1076
3、 Hikaricp source code analysis of connection acquisition process III
PHP database connection version1.1
How to quickly close port 8080
2、 Hikaricp source code analysis of connection acquisition process II
Does GoogleSEO need to change the friend chain? (e6zzseo)
Analyse du code source du processus d'acquisition et de connexion hikaricp II
Determine whether it is a web page opened on wechat