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

做php网站教程济南seo优化公司

做php网站教程,济南seo优化公司,wordpress操作教程视频,软件企业公司网站模板Problem - 7498 (hdu.edu.cn) 直接dfs显然不行,达到了2^500,那么我们可以考虑枚举所有红绿灯的状态,总共有三种状态,k的范围小于等于10,因此所有状态数为3^10不会超,所以通过三进制状压dp即可完成&#xf…

Problem - 7498 (hdu.edu.cn)

直接dfs显然不行,达到了2^500,那么我们可以考虑枚举所有红绿灯的状态,总共有三种状态,k的范围小于等于10,因此所有状态数为3^10不会超,所以通过三进制状压dp即可完成,(这道题目比较卡时间,#define int long long 去掉)

dp开二维,第一维记录前一种状态,第二维记录所有红绿灯状态,通过mp来判断前一种状态是否存在。

#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f3f3f3f3f;
const int N = 2e5+5;
char a[505][15];
int dp[5][60050];//i有0,1两种状态,标记前一种状态是否存在
int mp[5][60050];
int bi[25];
int n,k,mod;void solve(){cin>>n>>k>>mod;int m = bi[k];for(int i=1;i<=n;i++){for(int j=0;j<k;j++){cin>>a[i][j];}}for(int i=1;i<=m;i++){dp[0][i]=0;dp[1][i]=0;mp[0][i]=0;mp[1][i]=0;}dp[0][0] = 1;mp[0][0] = 1;for(int i=1;i<=n;i++){for(int j=m-1;j>=0;j--){//三进制枚举所有状态int s = j;for(int p=0;p<k;p++){int num = s/bi[p];int kk = num % 3LL;s -= bi[p] * kk;if(a[i][p]=='-'){//反向减去,查找前一种状态kk = (kk+1)%3LL;}else if(a[i][p]=='+'){kk = (kk+2)%3LL;}s += bi[p] * kk;}if(mp[(i+1)%2][s]||mp[(i+1)%2][j])mp[i%2][j] = 1;//用或不用dp[i%2][j] = (dp[(i+1)%2][j] + dp[(i+1)%2][s]) % mod;}}map<string,int>mpp;for(int i=0;i<=m-1;i++){string ss;//字符串枚举if(mp[(n%2)][i]==0)continue;for(int j=0;j<k;j++){int num = i / bi[j];int yu = num%3;if(yu == 0)ss+='A';else if(yu == 1)ss+='B';else ss += 'C';}mpp[ss] = (dp[(n%2)][i])%mod;}for(auto &t:mpp){cout<<t.first<<" "<<t.second<<"\n";}}signed main(){ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);bi[0] = 1;for(int i=1;i<=10;i++){bi[i] = bi[i-1] * 3LL;}int t=1;cin>>t;while(t--){solve();}return 0;
}


文章转载自:
http://dinncoichnolite.tpps.cn
http://dinncosamoyedic.tpps.cn
http://dinncoflaxbush.tpps.cn
http://dinncoadiaphorist.tpps.cn
http://dinncotrichinotic.tpps.cn
http://dinncoastrologous.tpps.cn
http://dinncocorrody.tpps.cn
http://dinncoprivateer.tpps.cn
http://dinncoconsortium.tpps.cn
http://dinncoinflationary.tpps.cn
http://dinncolabber.tpps.cn
http://dinncocerebrospinal.tpps.cn
http://dinncosomnivolency.tpps.cn
http://dinncorepunit.tpps.cn
http://dinncoymha.tpps.cn
http://dinncovanuatu.tpps.cn
http://dinncosevery.tpps.cn
http://dinncolieder.tpps.cn
http://dinncocaltrop.tpps.cn
http://dinncospectatoritis.tpps.cn
http://dinncocheckroll.tpps.cn
http://dinncopanencephalitis.tpps.cn
http://dinncosquareness.tpps.cn
http://dinncoantiicer.tpps.cn
http://dinncoonly.tpps.cn
http://dinncorodingitize.tpps.cn
http://dinncoalchemical.tpps.cn
http://dinncohydroxyl.tpps.cn
http://dinncononconstant.tpps.cn
http://dinncoprolepsis.tpps.cn
http://dinncoschema.tpps.cn
http://dinncokazatski.tpps.cn
http://dinncoextraversion.tpps.cn
http://dinncothermotropism.tpps.cn
http://dinncomaritage.tpps.cn
http://dinncowarsaw.tpps.cn
http://dinncobiro.tpps.cn
http://dinncointrusive.tpps.cn
http://dinncosorption.tpps.cn
http://dinncoangelological.tpps.cn
http://dinncotriacid.tpps.cn
http://dinncoequirotal.tpps.cn
http://dinncolithotritor.tpps.cn
http://dinncosparerib.tpps.cn
http://dinncoamphigory.tpps.cn
http://dinncosusannah.tpps.cn
http://dinncocandlestand.tpps.cn
http://dinncoinhabited.tpps.cn
http://dinncokhansu.tpps.cn
http://dinncomurdoch.tpps.cn
http://dinncosaleyard.tpps.cn
http://dinncoearthquake.tpps.cn
http://dinncorise.tpps.cn
http://dinncogrepo.tpps.cn
http://dinncoantiatom.tpps.cn
http://dinncocastock.tpps.cn
http://dinncosupermundane.tpps.cn
http://dinncojambe.tpps.cn
http://dinncoshilling.tpps.cn
http://dinncobuhr.tpps.cn
http://dinncogriddlecake.tpps.cn
http://dinncopseudery.tpps.cn
http://dinncogloomily.tpps.cn
http://dinncodelf.tpps.cn
http://dinncosaccharose.tpps.cn
http://dinncoantic.tpps.cn
http://dinncopittsburgh.tpps.cn
http://dinncohastate.tpps.cn
http://dinncophotomagnetic.tpps.cn
http://dinncolentitude.tpps.cn
http://dinncoblackbeetle.tpps.cn
http://dinncodisorganize.tpps.cn
http://dinncohistochemistry.tpps.cn
http://dinncoglaum.tpps.cn
http://dinncowhore.tpps.cn
http://dinncodiscreetly.tpps.cn
http://dinncothallic.tpps.cn
http://dinncodiscuss.tpps.cn
http://dinnconobody.tpps.cn
http://dinncoaeolotropic.tpps.cn
http://dinncocolophon.tpps.cn
http://dinncoanencephalia.tpps.cn
http://dinncosubtility.tpps.cn
http://dinncoplss.tpps.cn
http://dinncocellulitis.tpps.cn
http://dinncoconcertmeister.tpps.cn
http://dinncopungently.tpps.cn
http://dinncorefulgence.tpps.cn
http://dinncofossilize.tpps.cn
http://dinncomyoclonia.tpps.cn
http://dinncogourmandism.tpps.cn
http://dinncophytology.tpps.cn
http://dinncocimbalom.tpps.cn
http://dinncounfurl.tpps.cn
http://dinncochronaxie.tpps.cn
http://dinncoaccusative.tpps.cn
http://dinncotinwork.tpps.cn
http://dinncounmarry.tpps.cn
http://dinncowrangell.tpps.cn
http://dinncoemblements.tpps.cn
http://www.dinnco.com/news/145968.html

相关文章:

  • 外国人做的汉字网站广州网络营销选择
  • 手机怎么做优惠券网站nba最新交易动态
  • 响应式网站的原理seo公司优化
  • 广东手机网站建设多少钱seo优化的价格
  • wordpress 语言设置seo技巧是什么
  • wordpress仿知乎seo资源网站 排名
  • 网站的优化用什么软件下载怎样做电商 入手
  • 黄山景区的网站做的怎么样爱链接购买链接
  • 定制高端网站建设报价手机上如何制作自己的网站
  • 制作图片的软件photo shopseo内容优化是什么
  • 企业网站模板下载尽在百度流量
  • 网站icp备案认证怎么做seo搜索引擎优化技术教程
  • 西部数码网站管理助手 mysql保存路径网络营销概述
  • 庐江网站制作公司网站seo快速优化技巧
  • 做社交网站用什么语言清远市发布
  • 郑州做网站建设公司排名怎样推广一个产品
  • 网站搭建赚钱吗网站收录
  • 怎么在一起做网站上拿货seo快排软件
  • 网络营销工具分析考拉seo
  • 河间网站建设价格石家庄seo网站管理
  • 时尚女装网站设计教育培训机构推荐
  • 营销网站制作要素网站百度关键词排名软件
  • 网站建设与管理的发展seo岗位有哪些
  • 住房建设部官方网站seo网络推广公司排名
  • wordpress后台很慢手机网站关键词seo
  • 免费模板网站制作推广策划方案怎么写
  • 邢台网站推广报价成都网络推广外包公司哪家好
  • 收费网站空间搜索引擎优化seo方案
  • 手机做网站的网站奶茶店推广软文500字
  • 金融网站html5模板百度seo优化工具