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

W做网站海外推广平台有哪些?

W做网站,海外推广平台有哪些?,企业年报网上申报系统网址,婴幼儿用品销售网站开发报告C. You Soared Afar With Grace 题目: 思路: 很有意思的模拟题,代码细节需注意 因为题目没要求我们最小步骤什么的,同时n也比较小,所以按照题意模拟即可,但是注意细节,比如数的位置&#xff0c…

C. You Soared Afar With Grace

题目:

思路:

很有意思的模拟题,代码细节需注意

因为题目没要求我们最小步骤什么的,同时n也比较小,所以按照题意模拟即可,但是注意细节,比如数的位置,奇偶性,特殊情况等

代码:

#include <iostream>
#include <algorithm>
#include<cstring>
#include<cctype>
#include<string>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <memory>
using namespace std;
#define int long long
#define yes cout << "YES\n"
#define no cout << "NO\n"void solve()
{int n;cin >> n;vector<int> a(n+1),b(n+1);vector<int> bpos(n+1,0);for (int i = 1; i <= n; i++){cin >> a[i];}int flag = 0;for (int i = 1; i <= n; i++){cin >> b[i];flag |= (b[i] != a[n+1 - i]);bpos[b[i]] = i;}if (!flag){cout << "0\n";return;}int num = 0;vector<pair<int, int>> ans;for (int i = 1; i <= n; i++){if (a[bpos[a[i]]] != b[i]){cout << "-1\n";return;}if (a[i] == b[i]){if (n % 2 == 0 || num){cout << "-1\n";return;}num = i;}}auto change = [&](int x,int y) {if (x == y){return;}ans.push_back({ x,y });swap(a[x], a[y]);swap(b[x], b[y]);swap(bpos[b[x]], bpos[b[y]]);};if (num){change(num, (n + 1) / 2);}for (int i = 1; i <= n / 2; i++){change(bpos[a[i]], n + 1 - i);}cout << ans.size() << endl;for (auto x : ans)wcout << x.first << " " << x.second << endl;
}signed main()
{cin.tie(0)->sync_with_stdio(false);int t = 1;cin >> t;while (t--){solve();}return 0;
}

D. Arcology On Permafrost

题目:

思路:

需要一点观察的构造题

 我们最优的解法肯定是构造出一个类似与于 0 1 2 ... d 0 1 2 ... d 0 1 ... 这样的序列,其中任意一个数字都要出现 m + 1 次,这样才能保证最后能剩下这个数,同时相同的数一定要间隔 k ,这样才能保证不会一次删除两个的情况

所以这个 d 的最大值就是 n / (m + 1) - 1 (要包含0),间隔就是 max(d,k)

代码还是很好写的

代码:

#include <iostream>
#include <algorithm>
#include<cstring>
#include<cctype>
#include<string>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <stack>
#include <memory>
using namespace std;
#define int long long
#define yes cout << "YES\n"
#define no cout << "NO\n"void solve()
{int n, m, k;cin >> n >> m >> k;vector<int> ans(n);int d = n / (m + 1);for (int i = 0; i < d; ++i) {for (int j = i; j < n; j += max(k, d)){ans[j] = i;}}for (int i = 0; i < n; ++i) {cout << ans[i] << " ";}cout << endl;
}signed main()
{cin.tie(0)->sync_with_stdio(false);int t = 1;cin >> t;while (t--){solve();}return 0;
}

http://www.dtcms.com/wzjs/384741.html

相关文章:

  • 中山seo建站长沙谷歌seo
  • 如何在国外网站做推广湖南网站seo找行者seo
  • 手机有软件做ppt下载网站有哪些内容百度搜索的优势
  • 免费建立自己的网站代理刷神马关键字排名软件
  • wordpress虎嗅网主题通州优化公司
  • 做标记网站常用网站推广方法及资源
  • 关于建设网站业务系统的请示网页制作网站
  • wordpress换域名不能访问湖南关键词优化品牌价格
  • 新疆建设职业学院网站6最新推广注册app拿佣金
  • 网站面包屑导航怎么做的腾讯广告联盟官网
  • 做动物网站的原因是想要导航页面推广app
  • 深圳建设工程交易保定seo网络推广
  • 佛山外贸网站建设价位网络营销策略案例分析
  • 网站目前如何做外链链接式友谊
  • wordpress 整合铁岭网站seo
  • 虎门网站建设公司百度关键词优化词精灵
  • 想自己做个公司网站不知道怎么做我是做推广的怎么找客户
  • 北京信息维护公司简单的seo
  • 电商平台系统seo公司 彼亿营销
  • 沈阳男科医院在哪里seo效果检测步骤
  • 12306网站做的好丑提高工作效率的方法有哪些
  • 广州微网站建设案例快刷网站
  • 毕业设计做音乐网站网站建设流程是什么
  • 免费php企业网站管理系统北京昨天出啥大事了
  • 2021年php凉透了seo推广任务小结
  • 本标准在住房城乡建设部门户网站免费推广软件工具
  • 查网站是不是用shopify做的免费行情软件网站下载大全
  • .netcms网站管理系统免费换友情链接
  • 武汉汉口做网站公司新站seo优化快速上排名
  • 做网站哪里找程序员阿里云盘资源搜索引擎