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

贴码

Posted by lzy_Dennis at 2023-09-14 21:05:35 on Problem 1939
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int groupNum;
	while(cin>>groupNum) {
		double initX, initY;
		double preX, preY;
		double x,y;
		for(int i=0; i<groupNum; i++) {
			cin>>x>>y;
			if(i==0) {
				initX=x;
				initY=y;
				preX=x;
				preY=y;
				cout<<groupNum;
			} else {
				printf(" %0.6f %0.6f", preX+(x-preX)/2.0, preY+(y-preY)/2.0);
				preX=x;
				preY=y;
			}
		}
		printf(" %0.6f %0.6f\n",initX+(x-initX)/2.0, initY+(y-initY)/2.0);
	}
	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