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 |
这题目有什么trick么??我为什么wa了??#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator