POJ 1939
#include<iostream> #include<iomanip> #define MAXN 10000 using namespace std; double point[MAXN][2]; int main() { //freopen("acm.acm","r",stdin); int num; int i; while(cin>>num) { cin>>point[0][0]>>point[0][1]; cout<<num<<" "; for(i = 1; i < num; ++ i) { cin>>point[i][0]>>point[i][1]; cout<<setiosflags(ios::fixed)<<setprecision(6)<<(point[i][0]+point[i-1][0])/2.0<<" "<<(point[i][1]+point[i-1][1])/2.0<<" "; } cout<<setiosflags(ios::fixed)<<setprecision(6)<<(point[i-1][0]+point[0][0])/2.0<<" "<<(point[i-1][1]+point[0][1])/2.0<<endl; } }
关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。
技术网站地址: vmfor.com