poj 3792 Area of Polycubes
2014-04-03 20:47
465 查看
http://poj.org/problem?id=3792
View Code
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #define maxn 2000 using namespace std; struct node { int x,y,z; }p[maxn]; int main() { int t,n; scanf("%d",&t); for(int i=1; i<=t; i++) { int ans=0; scanf("%d",&n); scanf("%d,%d,%d%*c",&p[0].x,&p[0].y,&p[0].z); ans+=6; bool flag=true; for(int j=1; j<n; j++) { scanf("%d,%d,%d%*c",&p[j].x,&p[j].y,&p[j].z); if(!flag) { continue; } int k=0; ans+=6; flag=false; while(k<j) { int d=(abs(p[k].x-p[j].x)+abs(p[k].y-p[j].y)+abs(p[k].z-p[j].z)); if(d==0) { break; } if(d==1) { flag=true; ans-=2; } k++; } if(!flag||k!=j) { printf("%d NO %d\n",i,j+1); } } if(flag) { printf("%d %d\n",i,ans); } } return 0; }
View Code
相关文章推荐
- poj 3792 Area of Polycubes (简单模拟)
- POJ 3792 Area of Polycubes(思维)
- POJ 3792 Area of Polycubes(模拟)
- Area of Polycubes poj 3792
- POJ 3792 Area of Polycubes 解题报告
- liveoj 4238 - Area of Polycubes(搜索)
- Area of Polycubes
- 南邮 OJ 1537 G ? Area of Polycubes
- POJ 3792 Area of Polycubes 已被翻译
- [POJ1389]Area of Simple Polygons(扫描线+线段树)
- 【POJ 1389】Area of Simple Polygons(线段树+扫描线)
- poj 1389 Area of Simple Polygons(线段树做法)
- poj - 1389 - Area of Simple Polygons(离线化+扫描线+线段树)
- POJ 1389 Area of Simple Polygons(线段树+扫描面积)
- poj 1389 Area of Simple Polygons
- CSU 1697 Surface Area of Cubes (思维)
- POJ 1389 Area of Simple Polygons
- POJ-1389-Area of Simple Polygons
- POJ 1389 Area of Simple Polygons
- 【POJ】1389 Area of Simple Polygons