POJ 1939 Diplomatic License

题目描述

在这里插入图片描述
水题,使用结构体表示点坐标

#include<cstdio>
using namespace std;

struct point{
    
    
	long long x,y;
}first,last,now;

int main(){
    
    
	int n;
	while(scanf("%d",&n)!=EOF){
    
    
		printf("%d",n);
		scanf("%lld%lld",&first.x,&first.y);
		now=first;
		for(int i=1;i<n;i++){
    
    
		  scanf("%lld%lld",&last.x,&last.y);
		  printf(" %.6f %.6f",(last.x+now.x)/2.0,(last.y+now.y)/2.0);
		  now=last;
		}
		printf(" %.6f %.6f",(last.x+first.x)/2.0,(last.y+first.y)/2.0);
	    printf("\n");
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/qaqaqa666/article/details/112857559