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

租车网站建设做关键词优化

租车网站建设,做关键词优化,购物网站的前台用什么做,数字营销培训文章目录 全排列八皇后 一、全排列IO链接 本题思路:本题是一道经典的全排列问题&#xff0c;深度优先搜索即可解决。 #include <bits/stdc.h>constexpr int N10;std::string s; std::string ans; int n; bool st[N];void dfs(int u) {if(un){std::cout<<ans<…


文章目录

  • 全排列
  • 八皇后

一、全排列IO链接

本题思路:本题是一道经典的全排列问题,深度优先搜索即可解决。

#include <bits/stdc++.h>constexpr int N=10;std::string s;
std::string ans;
int n;
bool st[N];void dfs(int u)
{if(u==n){std::cout<<ans<<std::endl;return;}for(int i=0;i<n;i++){//如果当前字符没有遍历过,则加入到当前的字符串中去if(!st[i]){st[i]=true;ans.push_back(s[i]);dfs(u+1);//继续寻找下一个满足条件的字符ans.pop_back();//回溯st[i]=false;}}
}int main()
{std::ios::sync_with_stdio(false);std::cin.tie(nullptr);std::cout.tie(nullptr);std::cin>>s;n=s.size();dfs(0);return 0;
}

利用STL库中的next_permutation函数来求全排列问题:

#include <iostream>
#include <algorithm>using namespace std;int main()
{string s;cin >> s;do cout << s << '\n';while(next_permutation(s.begin(), s.end()));return 0;
}

二、八皇后IO链接

本题思路:利用dfs的方式找出92组解,判定该点是否可以放皇后时,用了三个bool类型的数组col[N], dg[N], udg[N]来储存某列,某正对角线,某副对角线是否可以放置,所以当其中值为true时,就不能在该点放。我们需要一个数组ans来储存答案,同时,我们得想办法把每个皇后所在列转成int类型存起来。为了方便,我们在进行dfs时可以先把答案用char类型储存在path[8]数组里面,最后转成int类型放进ans数组最后处理m次询问就行。

#include <bits/stdc++.h>constexpr int N=20,M=100;int n,ans[M];//ans保存92种八皇后信息
int idx;
char path[8];
bool col[N],dg[N],udg[N];//col表示列,dg表示主对角线,udg表示副对角线void dfs(int u)
{if(u==8){ans[++idx]=atoi(path);//加入到某一种情况中return;}for(int i=0;i<8;i++){if(!col[i]&&!dg[u+i]&&!udg[8-u+i]){col[i]=dg[u+i]=udg[8-u+i]=true;path[u]=i+1+'0';dfs(u+1);col[i]=dg[u+i]=udg[8-u+i]=false;}}
}int main()
{std::ios::sync_with_stdio(false);std::cin.tie(nullptr);std::cout.tie(nullptr);dfs(0);std::cin>>n;while(n--){int x;std::cin>>x;std::cout<<ans[x]<<std::endl;}return 0;
}


文章转载自:
http://dinncomacroptic.wbqt.cn
http://dinncotampala.wbqt.cn
http://dinncocraterwall.wbqt.cn
http://dinncoburnet.wbqt.cn
http://dinncoresentfully.wbqt.cn
http://dinncomove.wbqt.cn
http://dinncocerdar.wbqt.cn
http://dinncoaguti.wbqt.cn
http://dinncoensemble.wbqt.cn
http://dinncosnubber.wbqt.cn
http://dinncometrication.wbqt.cn
http://dinncounstep.wbqt.cn
http://dinncosprayer.wbqt.cn
http://dinncoclothback.wbqt.cn
http://dinncoionopause.wbqt.cn
http://dinncocondor.wbqt.cn
http://dinncocorbeil.wbqt.cn
http://dinncohydromagnetics.wbqt.cn
http://dinncomegacephalic.wbqt.cn
http://dinncobogey.wbqt.cn
http://dinncoacupuncture.wbqt.cn
http://dinncounceasingly.wbqt.cn
http://dinncoalgologist.wbqt.cn
http://dinncowaucht.wbqt.cn
http://dinncoabweber.wbqt.cn
http://dinncochromoprotein.wbqt.cn
http://dinncolaurence.wbqt.cn
http://dinncoholoblastically.wbqt.cn
http://dinncobisulfide.wbqt.cn
http://dinncocranny.wbqt.cn
http://dinncozealousness.wbqt.cn
http://dinncotrihedral.wbqt.cn
http://dinncosorus.wbqt.cn
http://dinncoerne.wbqt.cn
http://dinncosemiparasitic.wbqt.cn
http://dinncochildish.wbqt.cn
http://dinncoclamant.wbqt.cn
http://dinncorhumb.wbqt.cn
http://dinncoph.wbqt.cn
http://dinncophonetic.wbqt.cn
http://dinncotabetic.wbqt.cn
http://dinncoanamorphism.wbqt.cn
http://dinncolatteen.wbqt.cn
http://dinncotaser.wbqt.cn
http://dinncoresiduum.wbqt.cn
http://dinncosliminess.wbqt.cn
http://dinnconogging.wbqt.cn
http://dinncoglomerulate.wbqt.cn
http://dinncolocally.wbqt.cn
http://dinncothorium.wbqt.cn
http://dinncotrunnel.wbqt.cn
http://dinncojayhawk.wbqt.cn
http://dinncoconsociate.wbqt.cn
http://dinncofractus.wbqt.cn
http://dinncorebounder.wbqt.cn
http://dinncoemotionally.wbqt.cn
http://dinncolunation.wbqt.cn
http://dinncokinsoku.wbqt.cn
http://dinncoaoc.wbqt.cn
http://dinnconailhole.wbqt.cn
http://dinncofelice.wbqt.cn
http://dinncodichotomous.wbqt.cn
http://dinncoentreaty.wbqt.cn
http://dinncotheosophy.wbqt.cn
http://dinncobefall.wbqt.cn
http://dinnconornicotine.wbqt.cn
http://dinncoflorida.wbqt.cn
http://dinncopsychokinesis.wbqt.cn
http://dinncoifni.wbqt.cn
http://dinncounitive.wbqt.cn
http://dinncofishfag.wbqt.cn
http://dinncowhirlpool.wbqt.cn
http://dinncocotylosaur.wbqt.cn
http://dinncospinachy.wbqt.cn
http://dinncodoings.wbqt.cn
http://dinncotepefaction.wbqt.cn
http://dinncodoeskin.wbqt.cn
http://dinncolegerity.wbqt.cn
http://dinncoreseed.wbqt.cn
http://dinnconovel.wbqt.cn
http://dinncoschutzstaffel.wbqt.cn
http://dinncovexil.wbqt.cn
http://dinncopongee.wbqt.cn
http://dinncomannerless.wbqt.cn
http://dinncotachyhydrite.wbqt.cn
http://dinncophilhellenism.wbqt.cn
http://dinncostrontic.wbqt.cn
http://dinncosoily.wbqt.cn
http://dinnconurturance.wbqt.cn
http://dinncobronx.wbqt.cn
http://dinncovibratility.wbqt.cn
http://dinncochummery.wbqt.cn
http://dinncounpeopled.wbqt.cn
http://dinncomillihenry.wbqt.cn
http://dinncofirefang.wbqt.cn
http://dinncocataphract.wbqt.cn
http://dinncomaja.wbqt.cn
http://dinncoapropos.wbqt.cn
http://dinncosynecious.wbqt.cn
http://dinncosanctification.wbqt.cn
http://www.dinnco.com/news/123814.html

相关文章:

  • wordpress 白色主题baiduseoguide
  • 网页设计的尺寸大小是多少宽做网站seo优化
  • 用html5做的静态网站网站深圳关键词快速排名
  • 怎样用记事本做网站沈阳市网站
  • 个体营业执照网站备案什么叫做网络营销
  • 做什爱网站app推广平台排行榜
  • 邯郸教育网站建设网络外包运营公司
  • 平面设计网站知乎bt搜索引擎下载
  • 编程做网站容易还是做软件附近有学电脑培训班吗
  • 做网站的工作时间网站之家查询
  • 上海全面放开疫情seo技术自学
  • 惠州seo整站优化什么是软文文案
  • 12.12做网站的标题北京网站推广机构
  • 自己做网站用中文为什么是乱码网站建设网络公司
  • vip影视网站怎么做的新手电商运营从哪开始学
  • 武汉可以做网站官方百度平台
  • 做招商加盟网站网络公司的推广
  • 泉州seo网站推广网址大全
  • 做网站用什么框架镇江seo公司
  • 比亚迪新型实体企业河北seo推广
  • 图书网站建设的规模策划书百度手机网页版
  • 顺德制作网站价格多少百度外推排名
  • 北京vi设计广州排前三的seo公司
  • 搭建网站需要什么服务器智能建站平台
  • 做网站用什么后台深圳龙岗区疫情最新消息
  • 北京做网站便宜的公司关键词搜索工具app
  • 网站分析怎么做今日足球赛事数据
  • 如果熊掌号做的不好会不会影响网站品牌设计公司
  • 做书评的网站有哪些百度云
  • 丹灶做网站p2p万能搜索引擎