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

以2,3方向为x,y方向的正方向做一下坐标转换,那么A转换为矩形,B转换为两边平行与y轴的平行四边形,C... 然后扩展一下shoelace算法分别计算B类和C类的面积

Posted by lddlinan at 2020-10-07 19:38:35 on Problem 1439
大致这样的
  s=sb=sc=0;
  x1=y1=0;
  for (i=0; i<=n; i++) {
    if (i==n) {
      x2=y2=0;
    } else {
      scanf("%d %d", &d, &m);
      x2=x1+m*ss[d][0];
      y2=y1+m*ss[d][1];
    }
    s += (x1*y2); s-= (y1*x2);
    if (x1!=x2&&y1!=y2) {
      sc += (y2-y1)*(x1+x2);
      sb += (x2-x1)*(y1+y2);
    }
    x1=x2; y1=y2;
  }
  if (s<0) s=-s; s/=2;
  if (sc<0) sc=-sc; sc/=2;
  if (sb<0) sb=-sb; sb/=2;
  sa = s-sb-sc;

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