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

这题目有什么trick么??我为什么wa了??

Posted by kikif at 2007-09-21 10:43:35 on Problem 1939
#include <iostream>
#include <fstream>
#include <stdio.h>
using namespace std;

const int MAX=100000;


struct point{
	long x,y;
} p[MAX];


int main(){
//	ifstream cin("data.txt");
	int n;
	while(cin>>n){
		int i,j,x,y;
		for(i=0;i<n;i++){
			cin>>p[i].x>>p[i].y;
		}
		cout<<n;
		for(i=0;i<n-1;i++){
			double midx,midy;
			midx=(double)(p[i].x+p[i+1].x)/2;
			midy=(double)(p[i].y+p[i+1].y)/2;
			printf(" %.6lf %.6lf",midx,midy);
		}
		printf(" %.6lf %.6lf\n",(double)(p[0].x+p[n-1].x)/2,(double)(p[0].y+p[n-1].y)/2);
	}
	return 1;
}

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