博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
popStar手机游戏机机对战程序
阅读量:4638 次
发布时间:2019-06-09

本文共 1563 字,大约阅读时间需要 5 分钟。

DFS算,五分钟如果答案没有更新,那个解一般来说就很优了。

 

#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;int const uu[4] = { 1,-1,0,0};int const vv[4] = { 0,0,1,-1};typedef long long ll;int const inf = 0x3f3f3f3f;ll const INF = 0x7fffffffffffffffll;double eps = 1e-10;double pi = acos(-1.0);#define rep(i,s,n) for(int i=(s);i<=(n);++i)#define rep2(i,s,n) for(int i=(s);i>=(n);--i)#define mem(v,n) memset(v,(n),sizeof(v))#define lson l, m, rt<<1#define rson m+1, r, rt<<1|1struct node{ int x,y;}tempAns[205],Ans[205];char FIRST[101][101];bool VIS[101][101];int bestScore;int STEP;bool check(char mp[101][101],int x,int y){ rep(k,0,3){ int xx=x+uu[k], yy=y+vv[k]; if(xx>=1&&xx<=100 && yy>=1&&yy<=100 && mp[xx][yy]==mp[x][y]) return true; } return false;}int color1(char mp[101][101],bool vis[101][101],int x,int y){ vis[x][y]=true; int res=1; rep(k,0,3){ int xx=x+uu[k], yy=y+vv[k]; if(xx>=1&&xx<=100 && yy>=1&&yy<=100 && vis[xx][yy]==false && mp[xx][yy]==mp[x][y]) res+=color1(mp,vis,xx,yy); } mp[x][y]=0; return res;}void proc1(char mp[101][101]){ rep(j,1,10) rep2(i,9,1){ int g=i,h=j; while(g+1<=10 && mp[g+1][h]==0) ++g; mp[g][h]=mp[i][j]; if(g!=i) mp[i][j]=0; } rep(j,2,10){ if(mp[10][j]==0) continue; int k; for(k=j-1;k>=1;--k) if(mp[10][k]!=0) break; if(k+1
bestScore){ STEP=step; rep(i,0,step) Ans[i]=tempAns[i]; bestScore=score; cout<<"bestScore = "<
<

 

转载于:https://www.cnblogs.com/fish7/p/4068750.html

你可能感兴趣的文章
bzoj2120
查看>>
基于uFUN开发板的心率计(一)DMA方式获取传感器数据
查看>>
【dp】船
查看>>
oracle, group by, having, where
查看>>
⑥python模块初识、pyc和PyCodeObject
查看>>
object-c中管理文件和目录:NSFileManager使用方法
查看>>
Kibana:分析及可视化日志文件
查看>>
nodejs pm2使用
查看>>
cocos2d-x 3.10 PageView BUG
查看>>
装饰器的基本使用:用户登录
查看>>
CSS选择器总结
查看>>
mysql中sql语句
查看>>
head/tail实现
查看>>
sql语句的各种模糊查询语句
查看>>
vlc 学习网
查看>>
Python20-Day05
查看>>
Real World Haskell 第七章 I/O
查看>>
C#操作OFFICE一(EXCEL)
查看>>
【js操作url参数】获取指定url参数值、取指定url参数并转为json对象
查看>>
ABAP 程序间的调用
查看>>