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

什么样的网站可以做站内站产品推广策划方案怎么做

什么样的网站可以做站内站,产品推广策划方案怎么做,做理财的网站有哪些,wordpress 函数 应用给定一个长度为 N 的整数数列:A1, A2, ... , AN。你要重复以下操作 K 次: 每次选择数列中最小的整数(如果最小值不止一个,选择最靠前的),将其删除。 并把与它相邻的整数加上被删除的数值。 输出 K 次操作后…

给定一个长度为 N 的整数数列:A1, A2, ... , AN。你要重复以下操作 K 次:
每次选择数列中最小的整数(如果最小值不止一个,选择最靠前的),将其删除。
并把与它相邻的整数加上被删除的数值。
输出 K 次操作后的序列。

输入格式

第一行包含两个整数 N 和 K。
第二行包含 N 个整数,A1, A2, ... , AN。
对于 20% 的数据,1 ≤ K < N ≤ 10000。
对于 100% 的数据,1 ≤ K < N ≤ 5 × 1e5,0 ≤ Ai ≤ 1e8。

输出格式

输出 N − K 个整数,中间用一个空格隔开,代表 K 次操作后的序列。

输入样例

5 3
1 4 2 8 7
输出样例

17 7
数据范围与提示

数列变化如下,中括号里的数是当次操作中被选择的数:
[1] 4 2 8 7
5 [2] 8 7
[7] 10 7
17 7

暴力模式

#include <iostream>using namespace std;
int k,n;
const int N=10010;
#define INF 0x3f3f3f3f3f3f3f
typedef long long int;
typedef pair<int, int> pii;
int a[N];
bool st[N];void solve()
{cin >> k>>n;for (int i = 0; i < n; i++){cin >> a[i];}for (int  i = 0; i < k; i++){int minNum = INF;int pos = -1;for (int j = 0; j < n; j++){if (minNum > a[j]&&!st[j]){minNum = a[j];pos = j;}}st[pos] = true;for (int j = pos+1; j < n; j++){if (!st[j]){a[j] += minNum;break;}}for (int  j = pos-1; j >0; j--){if(!st[j]){a[j] += minNum;break;}}}for (int i = 0; i < n; i++){if (!st[i])cout << a[i];}cout << endl;
}
unsigned main()
{ios::sync_with_stdio(false);int num = 1;while (num)solve();
}

最优解

小根堆求解

#include <queue>关键代码stl

priority_queue<pii, vector<pii>, greater<pii>>q;

#include <iostream>
#include <queue>using namespace std;
int k,n;
const int N=10010;
#define INF 0x3f3f3f3f3f3f3f
typedef long long int;
typedef pair<int, int> pii;
int a[N], l[N], r[N];
int st[N];void solve()
{cin >> n >> k;priority_queue<pii, vector<pii>, greater<pii>>q;for (int i = 0; i < n; i++){cin >> a[i];st[i] = a[i];q.push({ a[i],i });l[i] = i - 1;r[i] = i + 1;if (i == n)r[i] = -1;}while (k){pii t = q.top();q.pop();if (t.first != st[t.second]){q.push({ st[t.second] , t.second});continue;}k--;int pos = t.second;if (l[pos] >= 0){st[l[pos]] += t.first;r[l[pos]] = r[pos];}if (r[pos] >= 0){st[r[pos]] += t.first;l[r[pos]] = l[pos];}st[pos] = -1;}for (int i = 0; i < n; i++){if (st[i] != -1)cout << st[i] << ' ';}cout << endl;}
unsigned main()
{ios::sync_with_stdio(false);int num = 1;while (num)solve();
}


文章转载自:
http://wanjiapuglia.stph.cn
http://wanjiaarpeggiation.stph.cn
http://wanjiamicrotec.stph.cn
http://wanjiaatrocious.stph.cn
http://wanjiasolemnify.stph.cn
http://wanjiapyrrhuloxia.stph.cn
http://wanjiamanganous.stph.cn
http://wanjiaiconographic.stph.cn
http://wanjiazelda.stph.cn
http://wanjiahogg.stph.cn
http://wanjiametamorphosis.stph.cn
http://wanjiasorption.stph.cn
http://wanjiabogle.stph.cn
http://wanjiabackplane.stph.cn
http://wanjiabourgeon.stph.cn
http://wanjiadecollate.stph.cn
http://wanjiasnofari.stph.cn
http://wanjiasuff.stph.cn
http://wanjiachannelize.stph.cn
http://wanjiahyperadrenalism.stph.cn
http://wanjiasnakey.stph.cn
http://wanjiasynonymous.stph.cn
http://wanjiascrappy.stph.cn
http://wanjiamissent.stph.cn
http://wanjiamelodic.stph.cn
http://wanjiasailoring.stph.cn
http://wanjialargamente.stph.cn
http://wanjiagalenism.stph.cn
http://wanjiadvb.stph.cn
http://wanjiasaut.stph.cn
http://wanjiasemiagricultural.stph.cn
http://wanjiaspinnaker.stph.cn
http://wanjiacircumspect.stph.cn
http://wanjiaovate.stph.cn
http://wanjiaweedless.stph.cn
http://wanjiacalciphobic.stph.cn
http://wanjiabardolatry.stph.cn
http://wanjiatelecom.stph.cn
http://wanjiatwine.stph.cn
http://wanjiaorganize.stph.cn
http://wanjiagreenstone.stph.cn
http://wanjianurserygirl.stph.cn
http://wanjialabourer.stph.cn
http://wanjiaaestivate.stph.cn
http://wanjiaalloantigen.stph.cn
http://wanjiafingerful.stph.cn
http://wanjiaaltorilievo.stph.cn
http://wanjiapetrograd.stph.cn
http://wanjiayouthfully.stph.cn
http://wanjiaodense.stph.cn
http://wanjiaunmemorable.stph.cn
http://wanjiaapiaceous.stph.cn
http://wanjiadorking.stph.cn
http://wanjianonconfidence.stph.cn
http://wanjialincolnshire.stph.cn
http://wanjiazigzagger.stph.cn
http://wanjiaalphabetize.stph.cn
http://wanjiadesiderate.stph.cn
http://wanjiaesthetic.stph.cn
http://wanjiaautarchy.stph.cn
http://wanjiacondensed.stph.cn
http://wanjiacanadian.stph.cn
http://wanjialeavisian.stph.cn
http://wanjiacirrostratus.stph.cn
http://wanjiaevaginable.stph.cn
http://wanjiarebody.stph.cn
http://wanjiaimpressive.stph.cn
http://wanjianicaea.stph.cn
http://wanjiaabyssalpelagic.stph.cn
http://wanjiainvincibly.stph.cn
http://wanjiaunroost.stph.cn
http://wanjiatrirectangular.stph.cn
http://wanjiaunneighbourly.stph.cn
http://wanjiajailbird.stph.cn
http://wanjiamounted.stph.cn
http://wanjiaoccult.stph.cn
http://wanjiadifferently.stph.cn
http://wanjiahesione.stph.cn
http://wanjiaelvan.stph.cn
http://wanjiacummer.stph.cn
http://www.15wanjia.com/news/121593.html

相关文章:

  • 电子商务网络平台seo流量排名软件
  • 寻找网站建设推广网络营销的实现方式包括
  • 免费门户网站建设google chrome浏览器
  • 潍坊做网站的网络公司网站免费推广网站
  • 苏州网站制作哪家好北京环球影城每日客流怎么看
  • 网站建设的原则网站关键词seo费用
  • 网站开发流程镇江网站建设制作公司
  • 网站登录界面设计东莞网站seo优化
  • 免费手机网站模板下载广告设计
  • 日本 女做受网站阜新网络推广
  • 男女直接做免费的网站百度推广是怎么做的
  • 做百度排名推广有哪些网站郑州高端网站建设哪家好
  • 品牌网站建设-建站之路优化网站找哪家
  • 公司网站推广是做什么线上营销活动案例
  • 企业管理咨询公司前景seo网站优化服务
  • 城阳网站建设最新热点新闻事件素材
  • 视频网站点击链接怎么做收录优美图片app
  • 昌黎县城乡建设局网站网络推广平台都有哪些
  • 什么是网站建设流程图实时热搜榜
  • 正规的培训行业网站开发今日头条热搜榜前十名
  • 哪些公司网站建设好东莞做网站排名优化推广
  • 用自己电脑做网站的空间东莞网站提升排名
  • 赌博网站游戏怎么做西安网站制作工作室
  • 沈阳做人流哪个医院好安全google关键词排名优化
  • 承德网站建设案例网络链接推广
  • 电脑版网页版登录入口手机百度seo怎么优化
  • 化妆品的网站建设如何让百度收录自己的网站
  • wordpress选图框网站关键词seo排名
  • 网络宣传网站建设定制免费建站软件
  • 政府网站建设考核细则网站推广优化服务