Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

终于过了。。。此题的关键是while(cin.eof) 不能写成while(true),否则OLE。另外最好边输入边输出

Posted by ILOVECC at 2014-10-26 14:11:48 on Problem 1939
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator