HDU 3682 To Be an Dream Architect (hash)
来源:互联网 发布:指纹机可以恢复数据么 编辑:程序博客网 时间:2024/05/21 11:11
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=3682
题意:
给你一个三维的立方体,每次去掉一列,去掉m列之后问你总共去掉了多少个1*1*1的小立方体。
题解:
用hash来标记每个小立方体,用vector保存,最后去掉重复的,余下的即位答案。
AC代码:
Accepted3682203MS4512K2373 BG++XH_Reventon#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <cstdlib>#include <cmath>#include <vector>#include <list>#include <deque>#include <queue>#include <iterator>#include <stack>#include <map>#include <set>#include <algorithm>#include <cctype>using namespace std;#define si1(a) scanf("%d",&a)#define si2(a,b) scanf("%d%d",&a,&b)#define sd1(a) scanf("%lf",&a)#define sd2(a,b) scanf("%lf%lf",&a,&b)#define ss1(s) scanf("%s",s)#define pi1(a) printf("%d\n",a)#define pi2(a,b) printf("%d %d\n",a,b)#define mset(a,b) memset(a,b,sizeof(a))#define forb(i,a,b) for(int i=a;i<b;i++)#define ford(i,a,b) for(int i=a;i<=b;i++)typedef long long LL;const int N=33;const int INF=0x3f3f3f3f;const double PI=acos(-1.0);const double eps=1e-8;vector<int> num;int main(){// freopen("input.txt","r",stdin); int nCase; int n, m; scanf("%d", &nCase); while(nCase--) { num.clear(); int len=0; scanf("%d%d", &n, &m); getchar(); while(m--) { char a, b; int val1, val2; scanf("%c=%d,%c=%d", &a, &val1, &b, &val2); getchar(); if(a=='X') { if(b=='Y') for(int i=1; i<=n; i++) num.push_back(val1*n*n+val2*n+i); else for(int i=1; i<=n; i++) num.push_back(val1*n*n+i*n+val2); } if(a=='Y') { if(b=='X') for(int i=1; i<=n; i++) num.push_back(val2*n*n+val1*n+i); else for(int i=1; i<=n; i++) num.push_back(i*n*n+val1*n+val2); } if(a=='Z') { if(b=='X') for(int i=1; i<=n; i++) num.push_back(val2*n*n+i*n+val1); else for(int i=1; i<=n; i++) num.push_back(i*n*n+val2*n+val1); } } sort(num.begin(), num.end());//排序 num.erase( unique( num.begin(), num.end() ), num.end());//去重 printf("%d\n", num.size()); } return 0;}
- HDU 3682 To Be an Dream Architect (hash)
- hdu 3682 To Be an Dream Architect (hash)
- Hdu 3682 To Be an Dream Architect(Hash)
- hdu 3682 To Be an Dream Architect hash
- hdu 3682(To Be an Dream Architect)
- hdu 3682To Be an Dream Architect
- hdu 3682 To Be an Dream Architect
- [水+思路] hdu 3682 To Be an Dream Architect
- vector 3682 To Be an Dream Architect
- HDOJ 3682 To Be an Dream Architect
- HDU 3682 To Be an Dream Architect (STL去重--思路题目)
- HDU 3682To Be an Dream Architect(统计规律题目 三线相交bug)
- HDOJ 3682 To Be an Dream Architect 暴力
- HDU3682 To Be an Dream Architect
- hdu3682 To Be an Dream Architect
- To Be an Dream Architect(2010年ACM亚洲预选赛杭州赛区第三题))
- To be a Java Architect
- How to be a Software Architect?(Transferred)
- 网络设备驱动程序
- “iOS 推送通知”
- C++实用函数
- C# 视频监控系列(7):服务器端——封装API(下) [DS40xxSDK.dll]
- autoconf与automake概述
- HDU 3682 To Be an Dream Architect (hash)
- 基于边界四边形的凸包生成
- C# 视频监控系列(8):服务器端——预览和可被客户端连接
- 简简单单---- (一) jsp简介
- C# 视频监控系列(9):服务器端——数据捕获(抓图 + 录像)
- 如何导出SQLserver数据库到文本文件
- android中病毒程序的模拟
- Spring Jar包解析
- C# 视频监控系列(10):服务器端——验证、设置画面质量、字幕叠加、板卡序列号