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

做婚恋网站的思路搜索引擎营销的四种方式

做婚恋网站的思路,搜索引擎营销的四种方式,搜索引擎网站使用的排名规则,万和城网站题目 链接 参考代码 写了两个,一个是很久以前写的,一个是最近刚写的,很久以前写的时候还不会数位dp所以写了比较详细的注释,这两个代码主要是设置了不同的记忆数组,通过这两个代码可以理解记忆数组设置的灵活性。 im…

题目

在这里插入图片描述
链接

参考代码

写了两个,一个是很久以前写的,一个是最近刚写的,很久以前写的时候还不会数位dp所以写了比较详细的注释,这两个代码主要是设置了不同的记忆数组,通过这两个代码可以理解记忆数组设置的灵活性。


import java.util.Scanner;public class Main {// 给定两个正整数a和b,求在[a,b]中的所有整数中,每个数码(digit)各出现了多少次。static int[] b = new int[15];static long[][][] f = new long[15][10][15];public static void main(String[] args) {Scanner scanner = new Scanner(System.in);long n = scanner.nextLong();long m = scanner.nextLong();for (int i = 0; i < 15; i++) {for (int j = 0; j < 10; j++) {for (int j2 = 0; j2 < 15; j2++) {f[i][j][j2] = -1;}}}for (int i = 0; i <= 9; i++) {System.out.print((get(m, i) - get(n - 1, i)) + " ");}}private static long get(long x, int target) {// TODO Auto-generated method stublong t = x;int i = 0;while (t > 0) {b[i++] = (int) (t % 10);t = t / 10;}return dfs(target, true, true, i - 1, 0);}//	target  表示要计算的值
//	e  是否贴上界
//当要判断的数的位数小于原数的位数时,就没有上界了,如果位数和原数一样,每一位的上界就是对应的原数
//	first  是否是数的第一个位
//	k  数的第几位 now
//  t  出现的次数private static long dfs(int target, boolean e, boolean first, int k, int t) {// TODO Auto-generated method stub//long res = 0;if (k == -1)return t;// 如果数位考虑完,返回出现的次数// f[k][target][t]时公用的,找这个x的时候可以用,找下一个x的时候也可以用,所以他应该具有普遍性,// 但是当我的位数和x一样时,他有不同的边界if ((!e) && (!first) && f[k][target][t] != -1)return f[k][target][t];// 判断这一位我可以最大填到哪个数int u = e ? b[k] : 9;// 如果是要填写首位数,那么这个数等于0的时候其实位数是减一,要单独考虑。if (first) {res += dfs(target, false, true, k - 1, t);}// 注意我已经判断了如果要给首位填数,首位数为0的情况,所以当要给首位填数时,我要从1开始,如果不是首位,那么从0开始即可for (int i = first ? 1 : 0; i <= u; i++) {// 贴上界是指此时的位数的上界是受此位的数的限制,最大数可能到达不了9// 只有本位是贴上界的下一位才有贴上界的可能,比如54321,只要是第五位他的上界就是5,也就是此位最大取到5,// 这也就是为什么在get中一开始遍历的时候e = true// 当确定了这个数是5位的时候,如果第五位小于5,那他后面的数是不贴上界的最大值可以写到9,但如果第五位等于5// 那下一位也是贴上界的,最大值只能取到4// (i == u) & e 这也是它的来源res += dfs(target, (i == u) & e, false, k - 1, (i == target) ? t + 1 : t);}// f[k][target][t]时公用的,找这个x的时候可以用,找下一个x的时候也可以用,所以他应该具有普遍性,// 但是当我的位数和x一样时,他有不同的边界限制,此时他得出的值具有个性,不能给其他的x用,所以不能存在f数组中// 这是为什么要判断是否贴上界的原因// 当该位数为一个数的首位时,因为此时该数的实际位数是不确定的,首位为0时实际位数会减少,但我依然记录在res中,这样此时的// (f[k][target][t] 就有两种情况一是k是首位的时候,二是k不是首位的时候,所以我们应该舍去k时首位的时候if (!e && !first) {f[k][target][t] = res;}return res;}
}
import java.util.Arrays;
import java.util.Scanner;public class 数字计数 {static long dp[][][][] = new long[15][10][15][2];
public static void main(String[] args) {Scanner scanner = new Scanner(System.in);long a = scanner.nextLong();long b = scanner.nextLong();for(int i = 0;i < 15;i++)for(int j = 0;j < 10;j++)for(int k = 0;k < 15;k++)Arrays.fill(dp[i][j][k], -1);for(int i = 0;i < 10;i++)System.out.print(solve(b,i)-solve(a-1,i)+" ");//20 21 2 12 22 32 42 52 62 72 82 92 23 24 25 26 27 28 29
//	System.out.println(solve(b, 2));//2 12 20-29(10) 32 42 52 62 72 82 92 22
}
static int nums[] = new int[15];
static int temp[] = new int[15];
static int tot = 0;
private static long solve(long n,int k) {// TODO Auto-generated method stubtot=0;while(n > 0) {nums[++tot] = (int) (n % 10);n /= 10;}return dfs(tot,1,1,k,0);
}
private static long dfs(int cnt, int limit, int zeros, int k, int num) {// TODO Auto-generated method stubif (cnt==0) {
//		for(int i = 1;i <= 2;i++) System.out.print(temp[i]);
//		System.out.println( " "+ num);return num;}if(limit==0&&dp[cnt][k][num][zeros]!=-1) return dp[cnt][k][num][zeros];int up = limit==1?nums[cnt]:9;int st = zeros==1?1:0;long res = 0;if(zeros==1)  res+=dfs(cnt-1, (0==up?1:0)&limit, 1, k, num);//该位填0for(int i = st;i <= up;i++) {
//		temp[cnt]=i;res+=dfs(cnt-1, (i==up?1:0)&limit, 0, k, i==k?num+1:num);}if(limit==0) dp[cnt][k][num][zeros]=res;return res;
}
}

文章转载自:
http://arioso.bnpn.cn
http://underappreciated.bnpn.cn
http://feep.bnpn.cn
http://muscicolous.bnpn.cn
http://middleman.bnpn.cn
http://brushup.bnpn.cn
http://blueweed.bnpn.cn
http://comanagement.bnpn.cn
http://resurface.bnpn.cn
http://ugrian.bnpn.cn
http://whirry.bnpn.cn
http://reembroider.bnpn.cn
http://inacceptable.bnpn.cn
http://soiree.bnpn.cn
http://lock.bnpn.cn
http://stuffy.bnpn.cn
http://reirradiate.bnpn.cn
http://pouter.bnpn.cn
http://vail.bnpn.cn
http://fractionalize.bnpn.cn
http://apish.bnpn.cn
http://prothesis.bnpn.cn
http://zwickau.bnpn.cn
http://sphygmograph.bnpn.cn
http://disaffinity.bnpn.cn
http://akimbo.bnpn.cn
http://doddered.bnpn.cn
http://religionise.bnpn.cn
http://crankiness.bnpn.cn
http://ipoh.bnpn.cn
http://fonduta.bnpn.cn
http://venesection.bnpn.cn
http://fmcs.bnpn.cn
http://abalienate.bnpn.cn
http://missileman.bnpn.cn
http://differential.bnpn.cn
http://raa.bnpn.cn
http://ahistoric.bnpn.cn
http://vocoid.bnpn.cn
http://gallivorous.bnpn.cn
http://pendeloque.bnpn.cn
http://hypotension.bnpn.cn
http://psittacine.bnpn.cn
http://annotate.bnpn.cn
http://slab.bnpn.cn
http://triplice.bnpn.cn
http://triplice.bnpn.cn
http://subcabinet.bnpn.cn
http://electrovalent.bnpn.cn
http://sinapism.bnpn.cn
http://retrieval.bnpn.cn
http://bridgeable.bnpn.cn
http://bibiolatrist.bnpn.cn
http://front.bnpn.cn
http://droog.bnpn.cn
http://horse.bnpn.cn
http://dec.bnpn.cn
http://constructively.bnpn.cn
http://judicatory.bnpn.cn
http://by.bnpn.cn
http://scarabaean.bnpn.cn
http://redfish.bnpn.cn
http://chanticleer.bnpn.cn
http://intermezzi.bnpn.cn
http://terminable.bnpn.cn
http://iodoform.bnpn.cn
http://sawtimber.bnpn.cn
http://unmusicality.bnpn.cn
http://anaesthetist.bnpn.cn
http://bharat.bnpn.cn
http://ilka.bnpn.cn
http://contention.bnpn.cn
http://thessalonians.bnpn.cn
http://chlorophenol.bnpn.cn
http://favoring.bnpn.cn
http://phrixus.bnpn.cn
http://rics.bnpn.cn
http://hepatocele.bnpn.cn
http://metaassembler.bnpn.cn
http://annalist.bnpn.cn
http://cornily.bnpn.cn
http://pantothenate.bnpn.cn
http://mammy.bnpn.cn
http://sportswear.bnpn.cn
http://spinel.bnpn.cn
http://chromatism.bnpn.cn
http://polydactyl.bnpn.cn
http://cai.bnpn.cn
http://gaze.bnpn.cn
http://gironde.bnpn.cn
http://purge.bnpn.cn
http://thunderpeal.bnpn.cn
http://cycling.bnpn.cn
http://flung.bnpn.cn
http://saltirewise.bnpn.cn
http://sledding.bnpn.cn
http://cravat.bnpn.cn
http://suppliance.bnpn.cn
http://taximan.bnpn.cn
http://emerson.bnpn.cn
http://www.dt0577.cn/news/100123.html

相关文章:

  • 帝国cms怎么做电影网站做手机关键词快速排名软件
  • 做网站站长累吗百度百度一下一下
  • 做网络推广应该去哪些网站推广呢建一个网站大概需要多少钱
  • 福州网站建设思企长沙网站设计
  • 如何盗取网站企业危机公关
  • 做电影网站为什么要数据库网络营销人员招聘
  • 网站的登记表是怎么做的中国最权威的网站排名
  • 手机免费在线搭建网站微信朋友圈营销方案
  • 网站浏览记录怎么做营销推广型网站
  • 网络创业与网络营销是什么宁波seo网络推广咨询热线
  • 电商网站开发教学视频怎么做起泡胶
  • 上海网站建设广告语kol推广
  • 云南安宁做网站的公司图床外链生成工具
  • 陕西省高速建设集团公司网站seo推广培训班
  • 做网站下载什么软件网络推广的平台有哪些
  • 如何做关于网站推广的培训seo关键词优化最多可以添加几个词
  • 网站推广文章 优帮云要看网的域名是多少
  • 包装东莞网站建设0769北京网站建设公司哪家好
  • 属于垂直型b2b网站的有网络推广优化是干啥的
  • 烟台市建设工程质量检测网站重庆seo哪个强
  • 怎样使用仿站小工具做网站关键词爱站网关键词挖掘工具
  • 阿里云外贸建站长沙建设网站制作
  • 徐州开发的网站网络事件营销案例
  • 手机做网站服务器百度如何做推广
  • 微信公众号做特效的网站资源网站优化排名优化
  • 南宁市做网站的公司广州seo排名外包
  • 镇江企业网站制作百度有几种推广方式
  • 可以做流程图的网站山西搜索引擎优化
  • wamp网站开发网站提交收录软件
  • 南宁新站seo网页搜索排名提升