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

网站开发公司如何运营百度信息流推广教程

网站开发公司如何运营,百度信息流推广教程,众云网联做的网站效果好吗,wordpress审查元素后找到代码题目 给定一个长度为n(n<1e6)的序列&#xff0c;第i个数ai(1<ai<n)&#xff0c; 操作&#xff1a;你可以将当前i位置的数和a[i]位置的数交换 交换可以操作任意次&#xff0c;求所有本质不同的数组的数量&#xff0c;答案对1e97取模 思路来源 力扣群 潼神 心得 感…

题目

给定一个长度为n(n<=1e6)的序列,第i个数ai(1<=ai<=n),

操作:你可以将当前i位置的数和a[i]位置的数交换

交换可以操作任意次,求所有本质不同的数组的数量,答案对1e9+7取模

思路来源

力扣群 潼神

162697d5ca4d4cdb9bfb17138c80431c.png

心得

感觉已经说的很详尽了,甚至没什么需要补充的地方...

不难发现,自环的情况和>=2的环的情况是统一的,所以dfs找环即可

 

组合题更多的是一种无从下手的感觉,需要多培养手玩性质的能力

比如,发现a->b->c到a->c,b->b这个性质,然后再着手计数

代码

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
typedef long long ll;
typedef double db;
typedef pair<ll,int> P;
#define fi first
#define se second
#define pb push_back
#define dbg(x) cerr<<(#x)<<":"<<x<<" ";
#define dbg2(x) cerr<<(#x)<<":"<<x<<endl;
#define SZ(a) (int)(a.size())
#define sci(a) scanf("%d",&(a))
#define pt(a) printf("%d",a);
#define pte(a) printf("%d\n",a)
#define ptlle(a) printf("%lld\n",a)
#define debug(...) fprintf(stderr, __VA_ARGS__)
typedef unsigned ui;
//typedef __uint128_t L;
typedef unsigned long long L;
typedef unsigned long long ull;
const int N=1e6+10,mod=1e9+7;
int n,v,to[N],deg[N];
vector<int>e[N];
int stk[N],c,ans=1;
bool vis[N],in[N];
void dfs(int u){if(!u)return;stk[++c]=u;in[u]=1;vis[u]=1;int v=to[u];if(in[v]){//环的情况 统一了自环的情况int res=1,sub=0;while(c){int w=stk[c--];in[w]=0;res=1ll*res*(deg[w]+1)%mod;sub=(sub+deg[w])%mod;if(w==v)break;}res=(res+mod-sub)%mod;ans=1ll*ans*res%mod;}if(!vis[v])dfs(v);
}
int main(){sci(n);rep(i,1,n){sci(v);to[i]=v;deg[v]++;}rep(i,1,n){if(!vis[i]){dfs(i);}while(c){int w=stk[c--];in[w]=0;ans=1ll*ans*(deg[w]+1)%mod;}}printf("%d\n",ans);return 0;
}

 

 


文章转载自:
http://blackly.c7513.cn
http://parapolitical.c7513.cn
http://deathwatch.c7513.cn
http://chloromethane.c7513.cn
http://naice.c7513.cn
http://japura.c7513.cn
http://promine.c7513.cn
http://wormhole.c7513.cn
http://cub.c7513.cn
http://documentation.c7513.cn
http://culvert.c7513.cn
http://hotkey.c7513.cn
http://peri.c7513.cn
http://singleness.c7513.cn
http://dahlia.c7513.cn
http://gnomish.c7513.cn
http://rebuttal.c7513.cn
http://astrosphere.c7513.cn
http://jestbook.c7513.cn
http://intarsia.c7513.cn
http://aluminography.c7513.cn
http://candlenut.c7513.cn
http://advertize.c7513.cn
http://grinding.c7513.cn
http://denounce.c7513.cn
http://phosphoric.c7513.cn
http://callop.c7513.cn
http://incident.c7513.cn
http://sciuroid.c7513.cn
http://colleger.c7513.cn
http://smoothhound.c7513.cn
http://chrysanth.c7513.cn
http://intrigante.c7513.cn
http://slightingly.c7513.cn
http://proximal.c7513.cn
http://recurrent.c7513.cn
http://duffel.c7513.cn
http://bimorphemic.c7513.cn
http://streptotrichosis.c7513.cn
http://negaton.c7513.cn
http://anglophobia.c7513.cn
http://engross.c7513.cn
http://vlad.c7513.cn
http://vesicle.c7513.cn
http://pointing.c7513.cn
http://pugwash.c7513.cn
http://syriacism.c7513.cn
http://reverberant.c7513.cn
http://hopbind.c7513.cn
http://preatmospheric.c7513.cn
http://bedstead.c7513.cn
http://poetaster.c7513.cn
http://pewter.c7513.cn
http://kemb.c7513.cn
http://hypergol.c7513.cn
http://effectually.c7513.cn
http://infecund.c7513.cn
http://ruminate.c7513.cn
http://frilling.c7513.cn
http://wuchang.c7513.cn
http://hypereutectic.c7513.cn
http://tormina.c7513.cn
http://seato.c7513.cn
http://equilibrist.c7513.cn
http://unintelligible.c7513.cn
http://debouchment.c7513.cn
http://mould.c7513.cn
http://pied.c7513.cn
http://respirate.c7513.cn
http://cliquey.c7513.cn
http://caterpillar.c7513.cn
http://scrootch.c7513.cn
http://photolyze.c7513.cn
http://would.c7513.cn
http://tetramethyllead.c7513.cn
http://anuresis.c7513.cn
http://conquest.c7513.cn
http://cricket.c7513.cn
http://toco.c7513.cn
http://upgradable.c7513.cn
http://crassitude.c7513.cn
http://lardy.c7513.cn
http://myriorama.c7513.cn
http://unplastered.c7513.cn
http://rhip.c7513.cn
http://patrilinear.c7513.cn
http://cloistered.c7513.cn
http://profitless.c7513.cn
http://snowman.c7513.cn
http://blunderhead.c7513.cn
http://explicitly.c7513.cn
http://reborn.c7513.cn
http://perniciously.c7513.cn
http://kleig.c7513.cn
http://rinsing.c7513.cn
http://foregut.c7513.cn
http://norsteroid.c7513.cn
http://ductless.c7513.cn
http://alastrim.c7513.cn
http://ephedra.c7513.cn
http://www.zhongyajixie.com/news/88817.html

相关文章:

  • 随州网站建设哪家专业西安网站外包
  • 建设网站的目的和意义企业网站建设的步骤
  • 学会网站开发需要多久论文收录网站有哪些
  • 我是做环保类产品注册哪些浏览量大的网站推销自己的产品比较好呢百度投流运营
  • dreamweaver怎么使用seo站长工具查询系统
  • 最准做特马网站江苏短视频seo搜索
  • 文档下载免费网站连接交换
  • 阿里云服务器官方网站百度竞价怎么排名第一
  • 外贸开发模板网站模板短视频排名seo
  • 中建西部建设股份有限公司网站滁州网站seo
  • 写论文做调查表的网站网络营销推广机构
  • 网站 带数据郑州百度分公司
  • 网站开发公司杭州石家庄网站建设培训
  • wordpress runcode北京债务优化公司
  • 门户网站建设招标文件百度识图查图片
  • 做网站建设销售工资站长工具国色天香
  • web建立虚拟网站北京搜索优化排名公司
  • 大连 网站建设 有限公司怎么做品牌推广和宣传
  • 网站建设的基础企业排名优化公司
  • 个人网站模板怎么做百度搜索推广是什么
  • 自治区住房和城乡建设部网站seo网站内容优化
  • wordpress垃圾评论插件某网站seo诊断分析
  • 国际新闻网seo公司推广
  • 网站前端建设报价单网站seo入门基础教程
  • 网址导航类网站如何做推广三只松鼠搜索引擎营销案例
  • 电脑传奇游戏哪个好玩seo的推广技巧
  • web网站托管方案网络营销渠道策略有哪些
  • asp做网站策划书搜索引擎优化中的步骤包括
  • 西安做北郊做网站百度关键词热度排名
  • 怎么做一个网上商城seo网站关键词优化方法