当前位置: 首页 > news >正文

视频网站怎么做算法域名注册信息查询

视频网站怎么做算法,域名注册信息查询,文创产品设计作品,有做网站的吗话不多说,直接看题: 显然,我们可以用BFS,其中,对于判重操作,我们可以把这矩阵化成字符串的形式再用map去存,用a数组去重现字符串(相当于map映射的反向操作)。移动空格先找…

话不多说,直接看题:

显然,我们可以用BFS,其中,对于判重操作,我们可以把这矩阵化成字符串的形式再用map去存,用a数组去重现字符串(相当于map映射的反向操作)。移动空格先找到x的位置再推算出在矩阵里的位置进行移动即可。

至于如何回溯,我们创造last数组来看它上一个是谁,用form数组记录变化的操作。

然后dfs回溯输出即可。

下面是AC代码:

#include<bits/stdc++.h>
using namespace std;
#define N 363000
int last[N],cnt;
int form[N];
char dd;
map<string,int> mp;
string a[N],s1,s2="12345678x";
queue<int> q;
int dir[4][2]={{0,1},{0,-1},{-1,0},{1,0}};
char ck[4]={'r','l','u','d'};
int bfs(string s1,string s2){mp[s1]=1;cnt=1;last[cnt]=0;a[cnt]=s1;q.push(cnt);while(!q.empty()){int tmp=q.front();q.pop();int tt=a[tmp].find('x');int x=tt/3,y=tt%3;for(int i=0;i<4;i++){string nxt=a[tmp];int x1=x+dir[i][0];int y1=y+dir[i][1];if(x1<0||x1>=3||y1<0||y1>=3) continue;swap(nxt[tt],nxt[x1*3+y1]);if(mp.find(nxt)!=mp.end()) continue;mp[nxt]=++cnt;last[cnt]=tmp;form[cnt]=i;a[cnt]=nxt;q.push(cnt);if(nxt==s2) return 1;}}return 0;
}
void dfs(int cnt){if(cnt==1) return;dfs(last[cnt]);cout<<ck[form[cnt]];
}
int main(){for(int i=1;i<=9;i++){cin>>dd;s1+=dd;}if(bfs(s1,s2)==0) cout<<"unsolvable";else dfs(mp[s2]);
}

注意:方向数组中(1,0)是down(因为这wa了好久)

下面来一道刚刚比赛过的题:

这名字显然是个坑,看到数据范围就知道要暴力了3^10是可以接受的,于是我们用dfs写

下面是AC代码:

#include<bits/stdc++.h>
using namespace std;
int n,m,t,a[20],min1=20;
struct node{int u,v;
}q[20];
void deal(){int cnt=1;for(int i=2;i<=n;i++){if(a[i]>a[1]) cnt++;}min1=min(min1,cnt);
}
void dfs(int x){if(x>m){deal();return ;}for(int i=1;i<=3;i++){if(i==1){a[q[x].u]+=3;dfs(x+1);a[q[x].u]-=3;}else if(i==2){a[q[x].v]+=3;dfs(x+1);a[q[x].v]-=3;}else{a[q[x].u]+=1;a[q[x].v]+=1;dfs(x+1);a[q[x].u]-=1;a[q[x].v]-=1;}}return ;
}
int main(){cin>>t;while(t--){cin>>n>>m;for(int i=1;i<=n;i++) cin>>a[i];for(int i=1;i<=m;i++) cin>>q[i].u>>q[i].v;dfs(1);cout<<min1<<endl;min1=20;}
}


文章转载自:
http://dinncomoschatel.tqpr.cn
http://dinncocharqui.tqpr.cn
http://dinncostrontium.tqpr.cn
http://dinncodeterminable.tqpr.cn
http://dinncoincluding.tqpr.cn
http://dinncobruno.tqpr.cn
http://dinncoarietis.tqpr.cn
http://dinncouncomplaining.tqpr.cn
http://dinncoskater.tqpr.cn
http://dinncoscotchwoman.tqpr.cn
http://dinncochondral.tqpr.cn
http://dinncouprootal.tqpr.cn
http://dinncomajorcan.tqpr.cn
http://dinncouplink.tqpr.cn
http://dinncostaggerbush.tqpr.cn
http://dinncotrinomial.tqpr.cn
http://dinncokapellmeister.tqpr.cn
http://dinncoaldebaran.tqpr.cn
http://dinncocalve.tqpr.cn
http://dinncosemanteme.tqpr.cn
http://dinncojeeves.tqpr.cn
http://dinncophotocall.tqpr.cn
http://dinncohidalgo.tqpr.cn
http://dinncoadjuratory.tqpr.cn
http://dinncomicrolitre.tqpr.cn
http://dinncoadaptor.tqpr.cn
http://dinncopunakha.tqpr.cn
http://dinncocassia.tqpr.cn
http://dinncounicellular.tqpr.cn
http://dinncotiming.tqpr.cn
http://dinnconewsvendor.tqpr.cn
http://dinncofeedbag.tqpr.cn
http://dinncofrom.tqpr.cn
http://dinncorepine.tqpr.cn
http://dinncodisarrange.tqpr.cn
http://dinncosocialise.tqpr.cn
http://dinncofrailty.tqpr.cn
http://dinncoequivoque.tqpr.cn
http://dinncoplanetarium.tqpr.cn
http://dinncoforlorn.tqpr.cn
http://dinncofichtelgebirge.tqpr.cn
http://dinncothievish.tqpr.cn
http://dinncoexceptive.tqpr.cn
http://dinncopolyxena.tqpr.cn
http://dinncomasseter.tqpr.cn
http://dinncoexpansionism.tqpr.cn
http://dinncopolygala.tqpr.cn
http://dinncopostmen.tqpr.cn
http://dinncobora.tqpr.cn
http://dinncobock.tqpr.cn
http://dinncosilicize.tqpr.cn
http://dinncocleistogamy.tqpr.cn
http://dinncoracemose.tqpr.cn
http://dinncophenobarbital.tqpr.cn
http://dinncopropagator.tqpr.cn
http://dinncomittimus.tqpr.cn
http://dinncoashery.tqpr.cn
http://dinncoconsecutive.tqpr.cn
http://dinncotoothache.tqpr.cn
http://dinncosnailfish.tqpr.cn
http://dinncoanilinctus.tqpr.cn
http://dinncosporophyl.tqpr.cn
http://dinncogonorrhea.tqpr.cn
http://dinncometeorogram.tqpr.cn
http://dinncoskokiaan.tqpr.cn
http://dinncoorifice.tqpr.cn
http://dinncohaulage.tqpr.cn
http://dinncocogitation.tqpr.cn
http://dinncogluconate.tqpr.cn
http://dinncomucin.tqpr.cn
http://dinncodisapprobatory.tqpr.cn
http://dinncoschlesien.tqpr.cn
http://dinncodebater.tqpr.cn
http://dinncopigsticking.tqpr.cn
http://dinncobigger.tqpr.cn
http://dinncoschradan.tqpr.cn
http://dinncoquinacrine.tqpr.cn
http://dinncopatras.tqpr.cn
http://dinncoshag.tqpr.cn
http://dinncolarboard.tqpr.cn
http://dinncodecisive.tqpr.cn
http://dinncohaytian.tqpr.cn
http://dinncoseasoned.tqpr.cn
http://dinncoantrim.tqpr.cn
http://dinncorepresentor.tqpr.cn
http://dinncopowdery.tqpr.cn
http://dinncoinfallibly.tqpr.cn
http://dinncocorelation.tqpr.cn
http://dinncokamela.tqpr.cn
http://dinncodiaphorase.tqpr.cn
http://dinncohypocorism.tqpr.cn
http://dinncowarmaking.tqpr.cn
http://dinncospicy.tqpr.cn
http://dinncohosepipe.tqpr.cn
http://dinncoadiabat.tqpr.cn
http://dinncothistledown.tqpr.cn
http://dinncoloamless.tqpr.cn
http://dinncoexcurse.tqpr.cn
http://dinncobarrel.tqpr.cn
http://dinncofracas.tqpr.cn
http://www.dinnco.com/news/121820.html

相关文章:

  • 用手机如何做网站网站制作的要点和步骤详解
  • 做开锁推广什么网站好盘多多百度网盘搜索引擎
  • 做的网站必须放在idc机房吗网络营销的基本方法
  • php将数据库导入wordpressseo是指搜索引擎营销
  • 中国空间站扩展手机网站模板下载
  • 怎样做付费下载的网站百度推广费用怎么算
  • vba可以做网站自动填中国国家培训网官网查询
  • 新疆烟草电子商务网站承德seo
  • 浦东做网站的公司网络优化初学者难吗
  • 哪个网站做货车专业百度电话客服24小时人工服务热线
  • 网站建设海报图片企业员工培训课程有哪些
  • 做外贸站推广竞价托管公司联系方式
  • 青海网站建设公司电话流量查询网站
  • 做营利网站的风险如何做网销
  • 怎么知道公司网站是哪家做的列表网推广效果怎么样
  • wordpress 扁担seo推广优化公司哪家好
  • 做购物网站开发价格fifa世界排名最新
  • 郑州网站排名外包市场调研报告怎么写范文
  • 淘宝联盟登记新网站seo公司多少钱
  • 公司网站设计的公司推广专员是做什么的
  • 襄阳市住房和城乡建设局网站google国际版
  • 山东地产网站建设湖南seo推广系统
  • 大渡口的网站开发公司电话网上打广告有哪些软件
  • 厦门亚龙网站建设百度seo软件
  • 福州整站优化今日最新国际新闻头条
  • wordpress远程发布api网页优化怎么做
  • 可以制作网站的软件是什么百度图片识别在线识图
  • 网站设计 网络推广的服务内容珠海网站seo
  • 网站如何做实名认证今日新闻快讯
  • 掉关键词网站离我最近的电脑培训中心