杭电acm题The Center of Gravity为什么AC不了

来源:百度知道 编辑:UC知道 时间:2024/05/25 18:46:24
The Center of Gravity
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 1 Accepted Submission(s) : 0
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
Everyone know the story that how Newton discovered the Universal Gravitation. One day, Newton walked
leisurely, suddenly, an apple hit his head. Then Newton discovered the Universal Gravitation.From then
on,people have sovled many problems by the the theory of the Universal Gravitation. What's more, wo also
have known every object has its Center of Gravity.
Now,you have been given the coordinates of three points of a triangle. Can you calculate the center
of gravity of the triangle?
Input
The first line is an integer n,which is the number of test cases.
Then n lines follow. Each line has 6 numbers x1,y1,x2,y2,x3,y3,which are the coordinates of three points.
The input is term

这道题相当恶心。
会多次输入testcase
你的程序改成这样就AC了。
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int n;
double a,b,c,d,e,f,x,y;
while(1)
{
cin>>n;
if(n==0) break;
for(int i=1;i<=n;i++)
{if(n==0) break;
cin>>a>>b>>c>>d>>e>>f;
x=(a+c+e)/3;
y=(b+d+f)/3;

cout<<fixed<<setprecision(1)<<x<<" "<<y<<endl;
}
}
return 0;
}
就是多增加一个循环。这道题就是坑人啊~~

hdu上N多题的题目描述与题目输入不符