1008 Gnome Tetravex】的更多相关文章

Gnome Tetravex Time Limit: 10 Seconds      Memory Limit: 32768 KB Hart is engaged in playing an interesting game, Gnome Tetravex, these days. In the game, at the beginning, the player is given n*n squares. Each square is divided into four triangles m…
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1008 题目大意:给你n*n的矩阵,每个格子里有4个三角形,分别是上右下左,每个三角形里面标记了数字,问你能否通过移动这n*n个格子,使得相邻两个三角形具有相同的数字? dfs暴搜,dfs(x,y)代表当前要放(x,y)这个位置. 然后枚举给定的每个格子. 如果说可以放,就dfs下一个格子. 这一道题需要把相同的格子压缩起来,也就是说为了节省时间,可以记录相同的格…
题目链接 题意 : 将n*n个正方形进行排列,需要判断相邻的正方形的相邻三角形上边的数字是不是都相等. 思路 : 只知道是个深搜,一开始不知道怎么搜,后来看了题解才明白,就是说不是自己去搜,而是将给定的正方形按照要求一个个往上摆,如果摆不下去了肯定是没有结果的.还有可以将一样的放一起,如果一个在某个位置放不下了,那么其他的更放不下了. #include <stdio.h> #include <iostream> #include <string.h> using nam…
练习使用DPS的题,不知道有无别的做法,思路不复杂.形式是统计并且进行数字配对. #include <stdio.h> ][],note[],ans[]; void ini(){ int i,j,top,right,bottom,left; ;i<;i++){ ;j<;j++) sub[i][j]=; note[i]=; ans[i]=; } m=; f=n*n; ;i<f;i++){ scanf("%d %d %d %d",&top,&r…
开放式存储阵列为每平方米有几个,否则,超时-- #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <set> #include <map> #include <st…
zoj1008:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1008 题目意思是有一个游戏,即给出一个图,该图是由n*n个小正方形组成,每个小正方形又由4个三角形组成,要求用这n*n个小正方形拼成一个图,该图的每个小正方形的相邻的三角形的中间的数是相同的 题解:dfs从左到右边,从上到下,一个一个放,并且进行判断,是否合理,如果合理就放置,反之则回溯. #include<iostream> #include<c…
DFS+剪枝~ #include<bits/stdc++.h> using namespace std; ][]; int N; int cnt; ]; ]; unordered_map<long long,int> pos; bool dfs (int v) { if (v==N*N) return true; ;i<cnt;i++) { ) continue; &&a[p[v-]][]!=a[i][]) continue; &&a[p[v-…
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  1024   Calendar Game       简单题  1027   Human Gene Functions   简单题  1037   Gridland            简单题  1052   Algernon s Noxious Emissions 简单题  1409   Commun…
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight Moves1101 Gamblers1204 Additive equations 1221 Risk1230 Legendary Pokemon1249 Pushing Boxes 1364 Machine Schedule1368 BOAT1406 Jungle Roads1411 Annive…
Elevator Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 56481    Accepted Submission(s): 30942 Problem Description The highest building in our city has only one elevator. A request list is made…