文章

1

粉丝

397

获赞

0

访问

7.3k

头像
1381 输入输出没问题,不知道错在哪了
P1381 北京邮电大学机试题
发布于2020年2月19日 19:02
阅读数 7.3k

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;


struct node{
    int a;
    int b;
}buf[100];

bool cmp(node c,node d){
    int i=c.a*c.a+c.b*c.b;
    int j=d.a*d.a+d.b*d.b;
    if(i!=j)
        return i<j;
    else return c.b<d.b;
}

int pop(node a[],int n)
{
    sort(a,a+n,cmp);
    if(n==0)
    {
        printf("empty\n");
        return 0;
    }
    else printf("%d+i%d\n",a[n-1].a,a[n-1].b);
    n=n-1;
    return n;
}

int in(node a[],int e,int f,int n)
{
    a[n].a=e;
    a[n].b=f;
    n=n+1;
    sort(a,a+n,cmp);
    return n;
}

int main()
{
    int n,siz=0,i;
    char g;
&...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发