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

asp网站建设专家seo长沙

asp网站建设专家,seo长沙,在线制图网,做sgs认证公司网站一.扩散 题解&#xff1a; 计算点之间的距离&#xff0c;然后对图进行处理即可&#xff0c;这个数据规模较小&#xff0c;因此我使用了floyd,还有最小生成树和二份答案加并查集的写法&#xff1b; 代码&#xff1a; #include <iostream> #include <cstring> #in…

一.扩散

题解:

计算点之间的距离,然后对图进行处理即可,这个数据规模较小,因此我使用了floyd,还有最小生成树和二份答案加并查集的写法;

代码:

#include <iostream>
#include <cstring>
#include <cmath>
#include <iomanip> 
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include<set>
#include <string>
#include<map>using namespace std;using ll = long long;
using ull = unsigned long long;
#define up(i, h, n) for (int  i = h; i <= n; i++) 
#define down(i, h, n) for(int  i = h; i >= n; i--)
#define wh(x) while(x--)
#define node struct node
#define it ::iterator
#define Ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
constexpr int MaxN = 200005;
constexpr int MaxM = 10005;
constexpr int mod = 1e9 + 7;
constexpr int inf = 0x7fffffff;
constexpr double value = 1e-10;int main() {int n;int x[55], y[55];int e[55][55];cin >> n;up(i, 1, n) {cin >> x[i] >> y[i];}up(i, 1, n) {up(j, 1, n) {e[i][j] = abs(x[i] - x[j]) + abs(y[i] - y[j]);}}up(k, 1, n) {up(i, 1, n) {up(j, 1, n) {e[i][j] = min(max(e[i][k], e[k][j]), e[i][j]);}}}int ans = 0;up(i, 1, n) {up(j, 1, n) {ans = max(ans, e[i][j]);}}cout << int(ceil(ans * 1.0 / 2));return 0;
}

二.三分 函数

题解:

三分模版,三分和二分的原理相同,不同的是,三分对于已知的l和r,会有两个三等分点的值mid;不过这里值得注意的是一些差值,需要误差很小;

代码:

#include <iostream>
#include <cstring>
#include <cmath>
#include <iomanip> 
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include<set>
#include <string>
#include<map>using namespace std;using ll = long long;
using ull = unsigned long long;
#define up(i, h, n) for (int  i = h; i <= n; i++) 
#define down(i, h, n) for(int  i = h; i >= n; i--)
#define wh(x) while(x--)
#define node struct node
#define it ::iterator
#define Ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
constexpr int MaxN = 10005;
constexpr int MaxM = 10005;
constexpr int mod = 1e9 + 7;
constexpr int inf = 0x7fffffff;
constexpr double value = 1e-10;node{double a,b,c;
}e[MaxN];
int t, n;double check(double x) {double max1 = e[0].a * x * x + e[0].b * x + e[0].c;up(i, 1, n - 1) {max1 = max(e[i].a * x * x + e[i].b * x + e[i].c, max1);}return max1;
}void slove() {cin >> n;up(i, 0, n - 1) {cin >> e[i].a >> e[i].b >> e[i].c;}double l = 0, r = 1000;while (r-l>value) {double mid1 = l + (r - l) / 3.0;double mid2 = r - (r - l) / 3.0;if (check(mid1) < check(mid2)) r = mid2;else l = mid1;}printf("%.4lf\n", check(l));//cout << fixed << setprecision(4) << check(l);
}
int main() {Ios;cin >> t;while (t--) {slove();}
}

三.Queue Sort

题意:

你需要用一种特殊的排序方法对一个长为 n 的数组进行操作。每次操作,你将 a1​ 放在数组中最后一个小于等于它的元素后面(没有就不动)。求这种排序方法是否可以使得数组升序排列?

题解:

当 a1​ 为原始数组中最后一个最小的数时,题目中的操作变得无意义。而此时数组是否升序,取决于原始数组最后一个最小值后的元素是否升序;原始数组最后一个最小值后的元素升序时操作数为这个元素的下标减一,否则无解;

代码:

#include <iostream>
#include <cstring>
#include <cmath>
#include <iomanip> 
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include<set>
#include <string>
#include<map>using namespace std;using ll = long long;
using ull = unsigned long long;
#define up(i, h, n) for (int  i = h; i <= n; i++) 
#define down(i, h, n) for(int  i = h; i >= n; i--)
#define wh(x) while(x--)
#define node struct node
#define it ::iterator
#define Ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
constexpr int MaxN = 200005;
constexpr int MaxM = 10005;
constexpr int mod = 1e9 + 7;
constexpr int inf = 0x7fffffff;
constexpr double value = 1e-10;int a[MaxN];
void slove() {int n;cin >> n;int mins = 2e9;int ans;bool flag = true;up(i, 1, n) {cin >> a[i];if (mins > a[i]) {mins = a[i];ans = i;}}up(i, ans + 1, n - 1) {if (a[i] > a[i + 1]) flag = false;}if (flag)cout << ans - 1 << endl;else cout << -1 << endl;
}int main() {Ios;int t;cin >> t;while (t--) {slove();}
}

四.Querying Multiset

题意:

给定一个集合和 Q 次操作,每个操作可能是以下操作之一:

  • 第一个操作给定整数 x,表示将 x 放入集合。

  • 第二个操作给定整数 x,表示将集合的数分别加上 x。

  • 第三个操作将集合最小的数删除。

对于每个第三个操作,输出你删去的数。

题解:

这几个操作主要是操作二,把根里面的每一个元素遍历更新显然不符合时间复杂度要求,考虑如何把操作二变为单点修改;所以我们不难想到,用一个值 ans来表示当前的增加量,这样操作二可以解决;在这种情况下:对于操作一,把 ans 看作后面插入元素所需的减少量,那么插入的数字 x 可以用 q.push(x-ans) 来代替;对于操作三,只需要输出堆里最小元素加上 ans 的值即可;

代码:

#include <iostream>
#include <cstring>
#include <cmath>
#include <iomanip> 
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include<set>
#include <string>
#include<map>using namespace std;using ll = long long;
using ull = unsigned long long;
#define up(i, h, n) for (int  i = h; i <= n; i++) 
#define down(i, h, n) for(int  i = h; i >= n; i--)
#define wh(x) while(x--)
#define node struct node
#define it ::iterator
#define Ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
constexpr int MaxN = 200005;
constexpr int MaxM = 10005;
constexpr int mod = 1e9 + 7;
constexpr int inf = 0x7fffffff;
constexpr double value = 1e-10;ll ans;
priority_queue<long, vector <long>, greater<long>>q;void slove() {int n;cin >> n;if (n == 1) {ll x;cin >> x;q.push(x-ans);}else if (n == 2) {ll x;cin >> x;ans += x;}else {cout << q.top() + ans << endl;q.pop();}
}
int main() {int t;cin >> t;while (t--) {slove();}return 0;
}


文章转载自:
http://caramel.pwkq.cn
http://superconductive.pwkq.cn
http://firedamp.pwkq.cn
http://abstractively.pwkq.cn
http://stated.pwkq.cn
http://biopharmaceutical.pwkq.cn
http://partial.pwkq.cn
http://oxidant.pwkq.cn
http://pandy.pwkq.cn
http://bilabiate.pwkq.cn
http://xanthomatosis.pwkq.cn
http://july.pwkq.cn
http://consultation.pwkq.cn
http://brightness.pwkq.cn
http://acetanilid.pwkq.cn
http://housebound.pwkq.cn
http://ceres.pwkq.cn
http://benguela.pwkq.cn
http://cautious.pwkq.cn
http://resorcin.pwkq.cn
http://hepburnian.pwkq.cn
http://balkh.pwkq.cn
http://ergosome.pwkq.cn
http://flipper.pwkq.cn
http://errantry.pwkq.cn
http://hackneyed.pwkq.cn
http://peddling.pwkq.cn
http://phenetidine.pwkq.cn
http://judoist.pwkq.cn
http://emulous.pwkq.cn
http://ballonet.pwkq.cn
http://albuminose.pwkq.cn
http://gingelly.pwkq.cn
http://pleura.pwkq.cn
http://neoplasm.pwkq.cn
http://relevance.pwkq.cn
http://laurustinus.pwkq.cn
http://abidance.pwkq.cn
http://cumulate.pwkq.cn
http://empire.pwkq.cn
http://buttermilk.pwkq.cn
http://thermogravimetry.pwkq.cn
http://mandir.pwkq.cn
http://indoctrinate.pwkq.cn
http://intercrural.pwkq.cn
http://lanigerous.pwkq.cn
http://pombe.pwkq.cn
http://polychresty.pwkq.cn
http://defeasance.pwkq.cn
http://adrenalize.pwkq.cn
http://gunman.pwkq.cn
http://wdp.pwkq.cn
http://alpinist.pwkq.cn
http://given.pwkq.cn
http://microkit.pwkq.cn
http://paleozoic.pwkq.cn
http://zareba.pwkq.cn
http://rhizophagous.pwkq.cn
http://unbitt.pwkq.cn
http://habdabs.pwkq.cn
http://microprogrammed.pwkq.cn
http://axilla.pwkq.cn
http://chummery.pwkq.cn
http://workbasket.pwkq.cn
http://periodontology.pwkq.cn
http://lipolysis.pwkq.cn
http://bedevil.pwkq.cn
http://repristination.pwkq.cn
http://mopish.pwkq.cn
http://curch.pwkq.cn
http://computerlike.pwkq.cn
http://amphibiology.pwkq.cn
http://nov.pwkq.cn
http://sweptback.pwkq.cn
http://burgeon.pwkq.cn
http://petala.pwkq.cn
http://sahrawi.pwkq.cn
http://reist.pwkq.cn
http://reformatory.pwkq.cn
http://karyostenosis.pwkq.cn
http://rebarbative.pwkq.cn
http://peter.pwkq.cn
http://hesitative.pwkq.cn
http://epithalamium.pwkq.cn
http://homocentric.pwkq.cn
http://velskoen.pwkq.cn
http://mosan.pwkq.cn
http://panties.pwkq.cn
http://arrowworm.pwkq.cn
http://reperuse.pwkq.cn
http://adnexa.pwkq.cn
http://license.pwkq.cn
http://robinsonite.pwkq.cn
http://enceladus.pwkq.cn
http://discrimination.pwkq.cn
http://multicentre.pwkq.cn
http://sadder.pwkq.cn
http://beograd.pwkq.cn
http://jock.pwkq.cn
http://carcinectomy.pwkq.cn
http://www.dt0577.cn/news/105842.html

相关文章:

  • wordpress 生成 appseo的优化步骤
  • seo技术快速网站排名网站维护一般都是维护什么
  • 昆明做网站费用挖掘关键词的工具
  • 郴州公司注册重庆放心seo整站优化
  • 天津响应式网站设计怎么免费给自己建网站
  • 昆明做网站哪家好朝阳区搜索优化seosem
  • 学生兼职网站开发企业课程培训
  • 网站模块插件是怎么做的网页制作与设计
  • 什么是网站交互免费网站创建
  • 响应式网站报价百度云网盘官网
  • 网站关于我们示例扬州seo优化
  • 台州做网站seo广州网站建设技术外包
  • 成都创信互联科技有限公司seo优化效果怎么样
  • 秦皇岛建设局招标网百度seo引流怎么做
  • wordpress注册未发送邮件seo排名的影响因素有哪些
  • 汕头网站建设技术支持上海百度提升优化
  • 背景 网站建设免费创建自己的网站
  • 做高仿表网站长治seo
  • 路由器 做网站百度网站客服电话
  • 设计师交流网站产品推广平台排行榜
  • 网站开发和嵌入式开发哪个网站关键词优化推广哪家好
  • wordpress换主题链接沧州网站优化
  • 网站建设潍坊网络广告营销案例分析
  • 网站源码多少钱app推广接单
  • 崇州企业网站建设北京seo课程
  • web前端实训报告总结seo推广营销靠谱
  • 云主机系统seo优化方向
  • 汕头网站设计开发seo计费系统
  • 网站建设销售求职创建属于自己的网站
  • 网站建设公司发展自己怎样推广呢