PAT Basic Level 1082 射击比赛 (20 分)

题目链接:

https://pintia.cn/problem-sets/994805260223102976/problems/994805260990660608

AC代码:

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

const int maxn=10010;
struct person{
    int number;
    double dis;
}per[maxn];

bool cmp(struct person a,struct person b){
    return a.dis>b.dis;
}

int main(){
    int N;
    scanf("%d",&N);
    for(int i=0;i
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;


int main(){
    int N;
    map a;
    scanf("%d",&N);
    string id;
    int x,y,sum;
    cin>>id;
    scanf("%d%d",&x,&y);
    int MAX=x*x+y*y,MIN=x*x+y*y;//测试点2 ,若输入数据只有一个元素(1分),
    string max1=id,min1=id;
    for(int i=1;i>id;
        scanf("%d%d",&x,&y);
        sum=x*x+y*y;
        a[id]=sum;
        if(sum>MAX){
            MAX=sum;
            max1=id;
        }
        if(sum

 

你可能感兴趣的:(PAT,PAT,Basic,Level)