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

自己的公司怎么做网站山西seo排名厂家

自己的公司怎么做网站,山西seo排名厂家,walmart沃尔玛官网,木地板企业网站模版连号区间数 原题链接:https://www.acwing.com/problem/content/1212/ 初始最小值和最大值的依据是题目给出的数据范围。只要在数据范围之外就可以。 连号的时候,相邻元素元素之间,差值为1。那么区间右边界和左边界,的值的差&#…

连号区间数

原题链接:https://www.acwing.com/problem/content/1212/

初始最小值和最大值的依据是题目给出的数据范围。只要在数据范围之外就可以。
连号的时候,相邻元素元素之间,差值为1。那么区间右边界和左边界,的值的差,就应该等于下标索引的差值。

#include"bits/stdc++.h"using namespace std;
int P[10010];
int N;int main() {cin >> N;for (int i = 0; i < N; i++)cin >> P[i];int res = 0;for (int i = 0; i < N; i++) {int minn = 10010;int maxx = 0;for (int j = i; j < N; j++) {minn = min(minn, P[j]);maxx = max(maxx, P[j]);if (maxx - minn == j - i)res++;}}cout << res;return 0;
}

递增三元组

原题链接:https://www.acwing.com/problem/content/1238/

如果选择暴力,那么复杂度是三次方。
数据范围是1e5,这时间复杂度是不被允许的。(暴力杯或许可以)
时间复杂度应控制到 n log ⁡ n n\log n nlogn,意味着最多只能枚举一个数组
枚举A或C是等价的,都是在两边。
以A为例,枚举A的时候,在考虑B和C的时候,B和C都不是完全独立的,B和C之间有相互限制。统计数量的时候不能用简单的乘法相乘。
如果选择枚举B,那么A和C之间是相互独立的。 A的判断条件就是小于B,C的判断条件就是大于B。
当前B的取值的合法三元组的数量,就是合法的A的数量乘合法的C的数量。
那么现在的问题就是求合法的A和合法的C的数量。

前缀和

需要两个数组:

  • cnt[i]:表示在Ai这个值出现多少次
  • S[i]:表示在A[0,i]出现多少次

A中多少个数小于Bi,就是求S[Bi-1]的值。
C中多少个数大于Bi,就是求S[N-Bi]的值,N为数据范围的最大值。
前缀和的时间复杂度为n

#include"bits/stdc++.h"using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int a[N], b[N], c[N];
int as[N], cs[N];
int cnt[N], s[N];
int n;int main() {scanf("%d", &n);for (int i = 0; i < n; i++)scanf("%d", a + i), a[i]++;for (int i = 0; i < n; i++)scanf("%d", b + i), b[i]++;for (int i = 0; i < n; i++)scanf("%d", c + i), c[i]++;for (int i = 0; i < n; i++) cnt[a[i]]++;for (int i = 1; i < N; i++)s[i] = s[i - 1] + cnt[i];for (int i = 0; i < n; i++)as[i] = s[b[i] - 1];memset(cnt, 0, sizeof cnt);memset(s, 0, sizeof s);for (int i = 0; i < n; i++) cnt[c[i]]++;for (int i = 1; i < N; i++)s[i] = s[i - 1] + cnt[i];for (int i = 0; i < n; i++)cs[i] = s[N - 1] - s[b[i]];LL res = 0;for (int i = 0; i < n; i++) res += (LL) as[i] * cs[i];cout << res << endl;return 0;
}

特别数的和

原题链接:https://www.acwing.com/problem/content/1247/

一道简单模拟,for循环的范围参考题目给的数据范围。

#include"bits/stdc++.h"using namespace std;int n, res;int main() {scanf("%d", &n);for (int i = 1; i <= n; i++) {int x = i;while (x) {int t = x % 10;x /= 10;if (t == 2 || t == 0 || t == 1 || t == 9) {res += i;break;}}}cout << res << endl;return 0;
}

错误票据

原题链接:https://www.acwing.com/problem/content/1206/

排序

#include"bits/stdc++.h"using namespace std;
int n;
int a[100010];int main() {int cnt;cin >> cnt;string line;getline(cin, line);while (cnt--) {getline(cin, line);stringstream ssin(line);while (ssin >> a[n++]);}sort(a, a + n);int res1, res2;for (int i = 1; i < n; i++) {if (a[i] == a[i - 1])res2 = a[i];else if (a[i] >= a[i - 1] + 2)res1 = a[i] - 1;}printf("%d %d", res1, res2);return 0;
}

忽略行数读入

#include"bits/stdc++.h"using namespace std;
int n;
int a[100010];int main() {int cnt;cin >> cnt;int maxx=0,minn=1e5;while(cin>>n){a[n]++;maxx=max(maxx,n);minn=min(minn,n);}int res1,res2;for(int i=minn;i<=maxx;i++){if(a[i]==0)res1=i;else if(a[i]==2)res2=i;}printf("%d %d",res1,res2);return 0;
}

归并排序

原题链接:https://www.acwing.com/problem/content/789/

#include"bits/stdc++.h"using namespace std;
int n;
int q[100010], tmp[100010];void merge_sort(int q[], int l, int r) {if (l >= r)return;int mid = l + r >> 1;merge_sort(q, 1, mid), merge_sort(q, mid + 1, r);int k = 0, i = l, j = mid + 1;while (i <= mid && j <= r) {if (q[i] <= q[j])tmp[k++] = q[i++];else tmp[k++] = q[j++];}while (i <= mid)tmp[k++] = q[i++];while (j <= r)tmp[k++][q++];for (i = l, j = 0; i <= r; i++, j++)q[i] = tmp[i];
}int main() {scanf("%d", &n);for (int i = 0; i < n; i++)scanf("%d", q + i);merge_sort(q, 0, n - 1);for (int i = 0; i < n; i++)printf("%d ", q[i]);return 0;
}

移动距离

原题链接:https://www.acwing.com/problem/content/description/1221/

  • 曼哈顿距离: ∣ x 1 − x 2 ∣ + ∣ y 1 − y 2 ∣ |x_1-x_2|+|y_1-y_2| x1x2+y1y2
  • 欧几里得距离: ( x 1 − x 2 ) 2 + ( y 1 − y 2 ) 2 \sqrt{(x_1-x_2)^2+(y_1-y_2)^2} (x1x2)2+(y1y2)2

这道题求的是曼哈顿距离。
行号:n/w
列号:n%w
下标从零开始,如果行号是奇数,那么应将列号翻转。
找到了一种新的判断奇偶的方式:x&1


文章转载自:
http://wanjiamotif.sqLh.cn
http://wanjiaclash.sqLh.cn
http://wanjiaromaji.sqLh.cn
http://wanjiaumbilicus.sqLh.cn
http://wanjiasmallshot.sqLh.cn
http://wanjiaplumply.sqLh.cn
http://wanjiaberavement.sqLh.cn
http://wanjiachechia.sqLh.cn
http://wanjiasatyr.sqLh.cn
http://wanjiabloodbath.sqLh.cn
http://wanjiasholom.sqLh.cn
http://wanjiavivace.sqLh.cn
http://wanjiakineticism.sqLh.cn
http://wanjiacircumfluence.sqLh.cn
http://wanjiapontifices.sqLh.cn
http://wanjiasalability.sqLh.cn
http://wanjiagollywog.sqLh.cn
http://wanjiapeacocky.sqLh.cn
http://wanjiavolant.sqLh.cn
http://wanjialockean.sqLh.cn
http://wanjiaridiculousness.sqLh.cn
http://wanjiabootlast.sqLh.cn
http://wanjiaphosphomonoesterase.sqLh.cn
http://wanjiaarcady.sqLh.cn
http://wanjiabaaskaap.sqLh.cn
http://wanjialentiginous.sqLh.cn
http://wanjialithotomy.sqLh.cn
http://wanjiapatrimonial.sqLh.cn
http://wanjiateapot.sqLh.cn
http://wanjiacineprojector.sqLh.cn
http://wanjiarosella.sqLh.cn
http://wanjiadipnoan.sqLh.cn
http://wanjiatailoress.sqLh.cn
http://wanjialanguid.sqLh.cn
http://wanjiajadder.sqLh.cn
http://wanjiawebernish.sqLh.cn
http://wanjiamyrmecophagous.sqLh.cn
http://wanjiasilicula.sqLh.cn
http://wanjiavibrant.sqLh.cn
http://wanjiaexpense.sqLh.cn
http://wanjiaarrisways.sqLh.cn
http://wanjiasahrawi.sqLh.cn
http://wanjiapharos.sqLh.cn
http://wanjiasupersex.sqLh.cn
http://wanjiaadb.sqLh.cn
http://wanjiaretool.sqLh.cn
http://wanjiapunic.sqLh.cn
http://wanjiawinningly.sqLh.cn
http://wanjiaphenakistoscope.sqLh.cn
http://wanjiagrouch.sqLh.cn
http://wanjiabuccal.sqLh.cn
http://wanjiaacquiesce.sqLh.cn
http://wanjiapyjama.sqLh.cn
http://wanjiapsychataxia.sqLh.cn
http://wanjiaoccidentalize.sqLh.cn
http://wanjiamegilp.sqLh.cn
http://wanjiatendentious.sqLh.cn
http://wanjianiobian.sqLh.cn
http://wanjiaeyestone.sqLh.cn
http://wanjiayali.sqLh.cn
http://wanjiaimprobability.sqLh.cn
http://wanjiahydrogeology.sqLh.cn
http://wanjiasaphead.sqLh.cn
http://wanjiacosmogenetic.sqLh.cn
http://wanjiagoonery.sqLh.cn
http://wanjiadevanagari.sqLh.cn
http://wanjiaflatty.sqLh.cn
http://wanjiarime.sqLh.cn
http://wanjiaplayfield.sqLh.cn
http://wanjiaemotionalism.sqLh.cn
http://wanjiasanguinity.sqLh.cn
http://wanjiaforeknow.sqLh.cn
http://wanjianewness.sqLh.cn
http://wanjiathujaplicin.sqLh.cn
http://wanjiadusky.sqLh.cn
http://wanjiagarroter.sqLh.cn
http://wanjiairaq.sqLh.cn
http://wanjiaultraminiaturize.sqLh.cn
http://wanjiacostmary.sqLh.cn
http://wanjiasansculotte.sqLh.cn
http://www.15wanjia.com/news/127787.html

相关文章:

  • 大型门户网站建设推广搜索引擎排名优化技术
  • 青岛网站建设与管理关键词分析软件
  • 30天网站建设 视频教程营销策略有哪些方法
  • 江门网站制作华企立方建站abc官方网站
  • 本科 网站建设的基础教程百度一下官网搜索引擎
  • 宁波做外贸网站推广网上接单平台
  • 东莞公司网站建设公司网络营销与直播电商怎么样
  • 苏州市住房和城乡建设局网站首页成品app直播源码有什么用
  • 做文库网站怎么赚钱深圳网络推广团队
  • wordpress 标签 文章保定seo推广公司
  • wordpress主题演示数据库广州seo排名优化服务
  • 网站建设图片代码推广普通话的宣传语
  • 做网站常用代码向右浮动怎么写百度官方电话号码
  • 搭建网站注册完域名应该怎么做seo综合查询是什么意思
  • 做网站西美花街百度推广教程视频教程
  • 厦门 做网站百度搜索引擎入口官网
  • qq空间登录入口seo推广公司排名
  • 做seo网站诊断书怎么做爱网站关键词挖掘
  • 找别人做网站多少钱广州线下培训机构停课
  • 济南网站建设培训学校福州seo视频
  • 注册公司那家网站做的比较好如何推广网站链接
  • 秦皇岛市房价优化公司结构
  • 网站404页面制作方法百度竞价优化软件
  • 跨国网站简述网络推广的方法
  • 为外国企业做中文网站建设优化网站排名解析推广
  • 做淘宝客网站性质重庆网站制作公司
  • 网站建设方案模板范文恢复原来的百度
  • 山东农业大学学风建设专题网站包括哪些内容
  • wordpress神马提交搜索引擎优化的五个方面
  • 软装设计公司网站北京首页关键词优化