M90H023:平面幾何:三角形重心
#include<stdio.h>
int main()
{
float x1, x2, x3;
float y1, y2, y3;
scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
printf("(%g,%g)", (x1+x2+x3)/3.0, (y1+y2+y3)/3.0);
}
輸入範例 | 輸出範例 |
23 34 34 56 56
100 100 -100 100 100 90 1 2 3 4 5 6 7 8 9 10 5 5 5 5 5 5 5 5 5 5 5 5 543 78243 -901 2785 | Size: 5 Average: 40.600 Size: 6 Average: 65.000 Size: 10 Average: 5.500 Size: 12 Average: 5.000 Size: 4 Average: 20167.500 |