poj1939

简单题

View Code
#include <iostream>
#include
<cstdio>
#include
<cstdlib>
#include
<cstring>
using namespace std;

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

int n;

void input()
{
printf(
"%d ", n);
scanf(
"%lld%lld", &first.x, &first.y);
last
= first;
for (int i = 1; i < n; i++)
{
scanf(
"%lld%lld", &now.x, &now.y);
printf(
"%.6f %.6f ", (last.x + now.x) / 2.0, (now.y + last.y) / 2.0);
last
= now;
}
now
= first;
printf(
"%.6f %.6f ", (last.x + now.x) / 2.0, (now.y + last.y) / 2.0);
putchar(
'\n');
}

int main()
{
//freopen("t.txt", "r", stdin);
while (scanf("%d", &n) != EOF)
input();
return 0;
}

你可能感兴趣的:(poj)