标签:
Description
Input
Output
Sample Input
Sample Output
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 using namespace std; 5 double ans[220][220]; 6 int main() 7 { 8 for(int j = 1; j < 200; j++) 9 { 10 for(int i = 0; i <= j; i++) 11 { 12 if(i == 0) 13 ans[i][j] = ans[j-1][i] + sqrt(1.0*j*j+1.0*(j-1)*(j-1)); 14 else 15 ans[i][j-i] = ans[i-1][j-i+1] + sqrt(2.0); 16 } 17 } 18 int N; 19 int x1,y1,x2,y2; 20 cin >> N; 21 while(N--) 22 { 23 cin >> x1 >> y1 >> x2 >> y2; 24 printf("%.3lf\n",fabs(ans[x1][y1]-ans[x2][y2])); 25 } 26 27 return 0; 28 }
标签:
原文地址:http://www.cnblogs.com/wangmengmeng/p/4552738.html