Page 1 of 2
10060 - A hole to catch a man
Posted: Tue Jun 25, 2002 8:36 pm
by 10153EN
I want to ask if there's mistakes in the sample input? It states that the line of input is in the form of T X0 Y0 X1 Y2 ... X0 Y0
However, for the sample input:
2
2 0 0 0 10 5 15 12 10 10 0 0 0
5 0 0 5 100 100 0 0 0
5 3
1
2 0 0 10 0 10 10 0 10
5 2
0
The second last line isn't of this format. Do I understand wrongly? If not, can anyone give the actual sample input data for this case? Thx.
Posted: Wed Jun 26, 2002 4:10 pm
by 10153EN
Problem solved. Just to add the first point at the end of the line~
Thx for reading~
10060 is there any mistake in the sample input?
Posted: Thu Oct 10, 2002 5:20 am
by ljb
the problem say:
Ti X0 Y0 X1 Y1 X2 Y2 … … Xn Yn X0 Y0
Where Ti is the thickness of the sheet, and Xi Yi are the coordinates of corner points. The line ends with co-ordinate of the first point.
but the second input does not end with the x0 y0
1
2 0 0 10 0 10 10 0 10 <-should be 0?
5 2
i got wrong answer ,55555555555
Posted: Mon Oct 21, 2002 4:55 pm
by cytse
I think that line should be
2 0 0 10 0 10 10 0 10 0 0
10060 It's frustating
Posted: Mon Apr 21, 2003 4:03 am
by jpfarias
Man, I thought I've got this problem, but it appears that something is wrong...
My approach to solve this problem was summing up all the volumes of the pieces and then dividing by the volume of the man hole. What's wrong?
Thanks, JP!
Posted: Fri Aug 08, 2003 9:37 am
by Whinii F.
It's likely you rounded off your result, but you must floor() it to get AC.

10060
Posted: Mon Mar 28, 2005 3:27 pm
by CodeMaker
Hi.......really this one is tough

any help plz? i m getting WRONG ANSWER.

A lot actually
Code: Select all
#include<cstdio>
#include<cmath>
struct point
{
double x,y;
};
point p[10];
int n;
double area(point a,point b,point c)
{
double area;
area=a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y);
return 0.5*fabs(area);
}
int main()
{
double sum,pt,r,t,total,pi=2*acos(0.0);
int k;
// freopen("in.in","r",stdin);
while(scanf("%d",&n)==1 && n)
{
total=0;
for(k=0;k<n;k++)
{
scanf("%lf%lf%lf%lf%lf",&pt,&p[0].x,&p[0].y,&p[1].x,&p[1].y);
sum=0;
while(scanf("%lf%lf",&p[2].x,&p[2].y) && (p[2].x!=p[0].x || p[2].y!=p[0].y))
{
sum+=area(p[0],p[1],p[2]);
p[1]=p[2];
}
total+=pt*sum;
}
scanf("%lf%lf",&r,&t);
printf("%.0lf\n",floor(total/(pi*r*r*t)));
}
return 0;
}
hmm
Posted: Mon Mar 28, 2005 3:56 pm
by shahriar_manzoor
The formula u r using is only acceptable for convex polygon. On the other hand the input polygons may be concave. For concave polygons some or the triangle areas must be negative if you want to get the true result.
Posted: Sun Apr 03, 2005 3:01 pm
by CodeMaker

Thank you, Now I have solved this problem and also thanks to my friend Dip who helped me to find the precision error.
10060
Posted: Wed Jun 01, 2005 7:48 pm
by asif_rahman0
Hello I'm facing problem to understand the problem 10060.Can anybody help me?

Posted: Thu Aug 18, 2005 4:32 am
by daveon
Hi,
The problem is basically this:
Given a volume L1,L2,...,LN and a volume of a man hole MH,
how many times can MH go into L1+L2+...+LN or
answer = floor( (L1+L2+...+LN) / MH );
10060 A Hole to Catch a Man WA
Posted: Sun Oct 16, 2005 9:43 am
by mohiul alam prince
Hi
I am getting wa in this problem but don't know why. I have trying to solve
this problem by this equation
Code: Select all
(x1y2 + x2y3 + x3y4 + ............. + xny1) - (y1x2 + y2x3 + y3x4 +.......... ynx1)
can any body help me.
Here is my code
Code: Select all
#include <stdio.h>
#include <string.h>
#include <math.h>
#define pi acos(-1)
char Table[100024];
double x[20005];
double y[20005];
int main() {
int i, j;
int N;
//freopen("D:\\in.txt", "r", stdin);
while (scanf("%d", &N) == 1) {
if (N == 0) break;
gets(Table);
double ans1 = 0, ans2 = 0, ans = 0;
for (j = 1; j <= N; j++) {
gets(Table);
char *p;
p = strtok(Table, " ");
int n = 1;
int m = 1;
double t;
sscanf(p, "%lf", &t);
while (1) {
p = strtok(NULL, " ");
if (p == NULL) break;
sscanf(p, "%lf", &x[n++]);
p = strtok(NULL, " ");
sscanf(p, "%lf", &y[m++]);
}
ans1 = ans2 = 0.0;
for (i = 1; i < n - 1; i++) {
ans1 += ((x[i] * y[i + 1]) - (y[i] * x[i + 1]));
}
ans1 += ((x[n] * y[1]) - (y[n] * x[1]));
ans += fabs(0.5 * (ans1) * t);
}
double area;
double r, s;
scanf("%lf %lf", &r, &s);
area = 1.0 * s * pi * r * r;
printf("%.0lf\n", floor(ans / area + .5));
}
return 0;
}
Thanks
MAP
Posted: Sun Oct 23, 2005 3:08 pm
by sohel
Why are you using gets to take input..
each polygon may be given in more than one line !!
Posted: Sun Oct 23, 2005 3:46 pm
by mohiul alam prince
Sohel
Thanks for your reply.
My solution has other problems i have fixed this problem and got
AC.
MAP.
Posted: Wed Oct 26, 2005 10:39 pm
by chops
please give me some I/O.
Thanks in advance.