洛谷图论入门题--基本题必做 图的遍历—2.铲雪车(snow)
发烧中,不想写解析了。
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 using namespace std; 5 double zhegetihaonan(int a,int b,int c,int d) 6 { 7 long double x,y; 8 x = abs(a - c); 9 y = abs(b - d); 10 return sqrt(x * x + y * y) / 10000; 11 } 12 int main() 13 { 14 int x, y; 15 cin>>x>>y; 16 int i, n, x1, y1, x2, y2; 17 double sum = 0; 18 while(cin >> x1 >> y1 >> x2 >> y2) 19 { 20 sum += zhegetihaonan(x1,y1,x2,y2); 21 } 22 int T = sum - 1; 23 double t = sum - T; 24 int te =floor(t * 60 + 0.5); 25 if(te >= 60){ 26 T ++; 27 te -= 60; 28 } 29 cout << T << ":"; 30 if(te < 10) cout << "0"; 31 cout << te << endl; 32 return 0; 33 }
好吧,这篇博客就先写这么多,毕竟时间有限,同行们看到了这篇随笔的话可以顺便看一个这个友情链接 蒟蒻 http://mrmorning.coding.me/大佬给你们助阵!