Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
终于过了。。。此题的关键是while(cin.eof) 不能写成while(true),否则OLE。另外最好边输入边输出#include <iostream> #include <iomanip> using namespace std; int main() { int n; cin>>n; while (cin.eof()) { long double *x = new long double[n]; long double *y = new long double[n]; cout<<n<<" "; cin>>x[0]>>y[0]; for (int i = 1; i < n; i++) { cin>>x[i]>>y[i]; cout<<fixed<<setprecision(6)<<(x[i-1]+x[i]) / 2.0<<" "<<(y[i-1]+y[i]) / 2.0<<" "; } cout<<fixed<<setprecision(6)<<(x[0]+x[n-1]) / 2.0<<" "<<(y[0] + y[n-1]) / 2.0<<endl; cin>>n; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator