Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求救,求救

Posted by quanjianan at 2005-09-18 12:22:36 on Problem 1899
#include<stdio.h>
main()
{
  long x,y,n,i,j,x0[100]={0},x1[100]={0},x2[100]={0},y0[100]={0},y1[100]={0},y2[100]={0},r[100]={0},temp;
  scanf("%d%d",&x,&y);
  scanf("%d",&n);
  for (i=0;i<n;n++)
       scanf("%d%d%d",&x0[i],&y0[i],&r[i]);
  for (i=0;i<n;n++)
    x1[i]=x0[i]-r[i];
    x2[i]=x0[i]+r[i];
    y1[i]=y0[i]-r[i];
    y2[i]=y0[i]+r[i];
  for (i=0;i<n;n++)
    for (j=i+1;j<n;n++)
      if (x1[i]>x1[j])
        {
           temp=x1[i];
           x1[i]=x1[j];
           x1[j]=temp;
        }
      if (x2[i]<x2[j])
        {
           temp=x2[i];
           x2[i]=x2[j];
           x2[j]=temp;
        }
      if (y1[i]>y1[j])
        {
           temp=y1[i];
           y1[i]=y1[j];
           y1[j]=temp;
        }
      if (y2[i]<y2[j])
        {
           temp=y2[i];
           y2[i]=y2[j];
           y2[j]=temp;
        }
  printf("%d",x*y-(x2[0]-x1[0])*(y2[0]-y1[0]));
  getch();
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator