
代码:
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
//devc里面输出错误但提交到pta却正确??
//求平方的函数是pow()
int cmp(const void *a,const void *b){
return *(long double *)b-*(long double *)a;//降序
}
int main()
{
int n,a,b;
scanf("%d",&n);
int x;
long double mo[n];
// double max=0;
for(int i=0;i<n;i++){
scanf("%d %d",&a,&b);
x=(pow(a,2)+pow(b,2));
//x=a*a+b*b;
mo[i]=(long double)(sqrt(x));
//if(sqrt(x)>max) max=sqrt(x);
}
qsort(mo,n,sizeof *mo,cmp);
printf("%.2llf",mo[0]);
//printf("%.2lf",max);
return 0;
}
在dev上运行:无法得到正确答案

但在pta上所有测试点都通过了,这是为什么?
