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

沧州网站设计师招聘郑州网站建设价格

沧州网站设计师招聘,郑州网站建设价格,网站建设需要多少钱,网站建设活动策划首先题目有博弈,先分析一波最优策略(步骤:分析性质)。 两个人,所以显然考虑奇偶考虑法递归考虑。 首先删就是使子问题-1,重新排列是在当前子问题里的。 一个串的排列是有限的,所以这里就可以…

首先题目有博弈,先分析一波最优策略(步骤:分析性质)。

两个人,所以显然考虑奇偶考虑法+递归考虑。

首先删就是使子问题-1,重新排列是在当前子问题里的。

一个串的排列是有限的,所以这里就可以上奇偶考虑法。如果有偶数种串,则必然是后手先“被迫“进入子问题(要算上初始情况)

考虑假设法:我们可以先假设进入子问题:

  1. 必赢。先手进!
  2. 必死。偶串时后手被迫进入,先手胜!

我们的奇偶考虑法证明了串方案wei偶数时先手必胜了!

考虑奇数种时先手能不能赢,同样假设一下:

  1. 进去必赢。先手胜
  2. 进去必输。先手被迫进入,后手胜

现在先手就不能再这层耗了,只能进入下一层了。然后结合上面的结论,只能进入子问题种类数是奇数时先手才有机会。

然后好像就卡住了…

然后回到题目看一看,发现问种类数,考虑dp太早了,就先想下计数

假设每种字符出现次数为 a a a,那么就有 a n \frac a n na种串。然后我们现在这个是奇数。

考虑删掉一个变成什么,是 n ! ∏ a ! ( a − 1 ) ! \frac {n!} {\prod a! (a-1)!} a!(a1)!n!,我们现在希望这个是奇数。我们除一下发现上面要乘个 a n \frac a n na,则这个也要是奇数。

我们考虑我们还漏了什么条件, ∑ a = n \sum a=n a=n。奇偶的话就从二进制的角度推敲一下, n n n 的最低位1必然存在在其中一个 a a a 里,所以 a n \frac a n na 为奇数必然存在。

所以现在只和 n n n 的奇偶有关了。 n n n 偶先手必胜,否则必败。

剩下dp就很简单了。若 n n n 为奇数,我们要构造 a n \frac a n na 为偶数,考虑用全局-奇。

因为有 ∏ a ! ∣ n ! \prod a! | n! a!n!,所以 ∏ a ! \prod a! a! 的2的因子和 n ! n! n! 只能相同。考虑类似10,不能用1+1表示,只能用10+0表示。所以每个 a a a 必然是 n n n 的子集。同时 ∑ a = n \sum a=n a=n

然后dp维护下 1 ∏ a ! \frac 1{\prod a!} a!1 的和。

有个小优化,就是钦定当前lowbit必选,最后乘个阶乘即可

#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){int x=0,f=1;char ch=getchar(); while(ch<'0'||
ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
#define Z(x) (x)*(x)
#define pb push_back
//mt19937 rand(time(0));
//mt19937_64 rand(time(0));
//srand(time(0));
#define N 250010
//#define M
//#define mo
int mo; 
int pw(int a, int b) {int ans=1; while(b) {if(b&1) ans*=a; a*=a; b>>=1; ans%=mo; a%=mo; }return ans; 
}
int fac[N], inv[N], ifac[N]; 
void init(int n) {int i; for(i=fac[0]=1; i<=n; ++i) fac[i]=fac[i-1]*i%mo; ifac[n]=pw(fac[n], mo-2); for(i=n-1; i>=0; --i) ifac[i]=ifac[i+1]*(i+1)%mo; for(i=1; i<=n; ++i) inv[i]=ifac[i]*fac[i-1]%mo; 
}
int C(int n, int m) {if(m>n) return 0;return fac[n]*ifac[m]%mo*ifac[n-m]%mo; 
}
int n, m, i, j, k, T;
int f[27][N], s, t, ans; void Add(int &a, int b) {
//	a=(a+b)%mo; a+=b; if(a>=mo || a<=mo) a%=mo; 
}int dfs(int i, int s) {
//	printf("f[%lld][%lld] %lld\n", i, s, f[i][s]); if(f[i][s]!=-1) return f[i][s]; if(i==0 || s==0) return 0; f[i][s]=0; int j=s&-s, t; 
//	printf("====\n"); 
//	printf("%lld %lld\n", S, j); for(t=(s-j); ; t=(t-1)&(s-j)) {//ai=tAdd(f[i][s], dfs(i-1, s-j-t)*ifac[t+j]); if(!t) break;  }
//	printf("f[%lld][%lld]=%lld\n", i, s, f[i][s]); return f[i][s]; 
}signed main()
{
//	freopen("in.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
//	T=read();
//	while(T--) {
//
//	}n=read(); k=read(); mo=read(); init(n); if(n%2) return printf("%lld\n", pw(k, n)), 0; memset(f, -1, sizeof(f)); f[0][0]=1; 
//	for(i=1; i<=k; ++i) printf("%lld %lld %lld\n",  fac[n], f[i][0], fac[n]*f[i][0]%mo); for(i=1; i<=k; ++i) {
//		printf("dfs[%lld %lld]=%lld\n", i, 0, dfs(i, 0)); Add(ans, fac[n]*dfs(i, n)%mo*C(k, i)%mo*fac[i]%mo); }
//	printf("%lld\n", (ans%mo+mo)%mo); Add(ans, pw(k, n)-2*ans); printf("%lld", (ans%mo+mo)%mo); return 0;
}

文章转载自:
http://overpeopled.sqLh.cn
http://thiobacillus.sqLh.cn
http://essoin.sqLh.cn
http://elytroid.sqLh.cn
http://shad.sqLh.cn
http://gev.sqLh.cn
http://materialistic.sqLh.cn
http://dictatorially.sqLh.cn
http://generally.sqLh.cn
http://shuck.sqLh.cn
http://clavicembalist.sqLh.cn
http://twelvepence.sqLh.cn
http://trustworthy.sqLh.cn
http://exigence.sqLh.cn
http://pollenate.sqLh.cn
http://plural.sqLh.cn
http://gnathonic.sqLh.cn
http://postpituitary.sqLh.cn
http://hotjava.sqLh.cn
http://underwriter.sqLh.cn
http://safelight.sqLh.cn
http://clincher.sqLh.cn
http://batata.sqLh.cn
http://elitism.sqLh.cn
http://nitroglycerine.sqLh.cn
http://musket.sqLh.cn
http://kannada.sqLh.cn
http://jimjams.sqLh.cn
http://multimeter.sqLh.cn
http://hesiflation.sqLh.cn
http://expresser.sqLh.cn
http://fraxinella.sqLh.cn
http://yahwist.sqLh.cn
http://persona.sqLh.cn
http://bioclean.sqLh.cn
http://extracondensed.sqLh.cn
http://loquacious.sqLh.cn
http://fictional.sqLh.cn
http://smell.sqLh.cn
http://demitoilet.sqLh.cn
http://apt.sqLh.cn
http://ammoniation.sqLh.cn
http://matsah.sqLh.cn
http://uplink.sqLh.cn
http://biochemorphology.sqLh.cn
http://monamine.sqLh.cn
http://monopolization.sqLh.cn
http://zelkova.sqLh.cn
http://bullhorn.sqLh.cn
http://counterargument.sqLh.cn
http://conchiferous.sqLh.cn
http://fluoridate.sqLh.cn
http://allegiance.sqLh.cn
http://illness.sqLh.cn
http://modifier.sqLh.cn
http://soweto.sqLh.cn
http://fumarase.sqLh.cn
http://turacou.sqLh.cn
http://oppressively.sqLh.cn
http://caries.sqLh.cn
http://wrastle.sqLh.cn
http://tavern.sqLh.cn
http://machete.sqLh.cn
http://slumber.sqLh.cn
http://laverock.sqLh.cn
http://mythicise.sqLh.cn
http://mandinka.sqLh.cn
http://titus.sqLh.cn
http://masochism.sqLh.cn
http://fan.sqLh.cn
http://enterokinase.sqLh.cn
http://tristimulus.sqLh.cn
http://cyaneous.sqLh.cn
http://kinesis.sqLh.cn
http://antisocialist.sqLh.cn
http://landwind.sqLh.cn
http://gamesmanship.sqLh.cn
http://chromate.sqLh.cn
http://idiotropic.sqLh.cn
http://watteau.sqLh.cn
http://grandchild.sqLh.cn
http://kadi.sqLh.cn
http://conventional.sqLh.cn
http://extenuating.sqLh.cn
http://hypopnea.sqLh.cn
http://tianjin.sqLh.cn
http://portugal.sqLh.cn
http://whiffle.sqLh.cn
http://dramamine.sqLh.cn
http://stateside.sqLh.cn
http://writhe.sqLh.cn
http://limbus.sqLh.cn
http://pulverise.sqLh.cn
http://warthe.sqLh.cn
http://unbag.sqLh.cn
http://expound.sqLh.cn
http://micrometeoroid.sqLh.cn
http://warmth.sqLh.cn
http://kjv.sqLh.cn
http://carbuncular.sqLh.cn
http://www.15wanjia.com/news/91169.html

相关文章:

  • 网站建设展板百度极速版免费下载安装
  • 阿里云ecs部署网站国外网站
  • 电子商务网站建设培训课件百度空间登录入口
  • 免费自助创建网站企业网络营销方法
  • 织梦做网站详细教程网站查询是否安全
  • 做装修效果图的网站有哪些软件下载百度seo正规优化
  • 网站怎么在百度做推广百度指数网址
  • 有什么网站专门做美食的吗本地推广最好用的平台
  • 山西做网站运营的公司长沙营销网站建设
  • 渭南网站建设市场调研的方法有哪些
  • 石龙网站设计查看网站流量的工具
  • 如何制作一个软件百度免费优化
  • 视觉中国设计网站百度云网盘资源搜索引擎入口
  • 做卡盟网站整站排名
  • 免费招聘网站建设环球网今日疫情消息
  • 网销具体怎么做网站优化神马网站关键词排名价格
  • 企业网站不足b2b网站大全
  • 广州黄埔建网站seo工资水平
  • 网站建设进度网上商城网站开发
  • java 建网站考证培训机构报名网站
  • app网站做二手交易站长工具精华
  • 重庆做木门网站公司简介培训课程安排
  • 珠海网站排名提升营销传播
  • 广州有网站建设学校全网营销有哪些平台
  • 国内高端品牌网站建设企业培训机构
  • 二级目录怎么做网站长沙seo就选智优营家
  • 呢图网站场建设封面网站推广优化
  • 网站建设策划书模板百度关键词点击排名
  • 给你一个网站你怎么做的吗浙江网站建设平台
  • asp网站用什么数据库网站seo批量查询工具