用Sqrt函数时,用C++提交容易编译出错,试试用G++

/***************************
# 2013-11-16 17:30:17
# Time: MS   Memory: K
# Author: zyh
***************************/

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

int main()
{
	int t,n,x0,y0,x1,y1,i;
	double ans,a[210],tmp = 2.0;
	a[0] = 0;a[1] = 1;
	for(i=2;i<205;i++)
		a[i] = a[i-1]+ (i-1)*sqrt(tmp)+ sqrt( i*i + (i-1)*(i-1)); //这里用C++提交总是提示编译出错

	scanf("%d",&t);
	while(t--){
		scanf("%d%d%d%d",&x0,&y0,&x1,&y1);
		if(x1+y1<x0+y0) swap(x0,x1),swap(y0,y1);
		printf("%.3lf\n", a[x1+y1] + (x1-x0)*sqrt(tmp)- a[x0+y0] );
	}
	return 0;
}