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

什么the wordpress优化营商环境工作总结

什么the wordpress,优化营商环境工作总结,天津建设教育培训中心网,杭州网站建设品牌Problem - A - Codeforces 思维题&#xff1a; 如果n不能整除p&#xff0c;就会多出一部分&#xff0c;这个部分可以作为调和者&#xff0c;使整个数组符合要求。 如果n能整除p&#xff0c;没有调和空间&#xff0c;只有看n/p*qm 来看代码&#xff1a; #include <bits/s…

Problem - A - Codeforces

思维题:

如果n不能整除p,就会多出一部分,这个部分可以作为调和者,使整个数组符合要求。

如果n能整除p,没有调和空间,只有看n/p*q==m

来看代码:

#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
int main()
{int t;cin >> t;while (t--){int n, m, p, q;cin >> n >> m >> p >> q;if (n % p == 0&&n/p*q!=m){cout << "NO" << endl;}else{cout << "YES" << endl;}}}

Problem - B - Codeforces

题目大意:

数组的第一个数可以通过对数组任意数乘-1从而成为大小为n的数组 第n/2大的数吗?

解法:

为了方便处理,把数都先变为正数,第一个数赋值给man后,对数组arr进行从小大到大排序

查看man在排序后位置在哪?

1.在中位数之前,解法简单:不断让比man大的数乘-1变得比man小,就能让man到中位数的位置。

2.在中位数之后,此时无论把比man大的数*-1还是比man小的数*-1都不行,怎么办?

只有对所有数*-1,看看man倒着数是不是在中位数的位置

来看代码:

#include <bits/stdc++.h>
#include<unordered_map>
using namespace std;
int main()
{int t;cin >> t;while (t--){int n;cin >> n;vector<int>arr(n);for (int i = 0; i < n; i++){cin >> arr[i];arr[i] = abs(arr[i]);}//一步登天int man = arr[0];int exp = (n + 1) / 2;exp -= 1;int flag = 0;sort(arr.begin(), arr.end());int now = 0;for (int i = 0; i < n; i++){if (arr[i] == man){now = i;break;}}if (now <= exp||n-1-now==exp){flag = 1;}else{flag = 0;}if (flag){cout << "YES" << "\n";}else{cout << "NO" << "\n";}}}

Problem - C - Codeforces

一道构造题目,怎么排,才能把子网格相加的mex得到最大呢?

因为有mex机制在,大的数在内部起不到作用,所以
大的数在外围,小的数在内部。最小的数0放在最中间,这样能保证最多的mex能包括到它。

解法:

从大到小,从外向内 蛇形放数

#include <iostream>
#include <vector>
using namespace std;vector<vector<int>> constructGrid(int n)
{vector<vector<int>>grid(n, vector<int>(n, -1));int current = n * n - 1;int x = 0;int y = n - 1;int dir = 0;vector<int>dx = { 0,1,0,-1};vector<int>dy = { -1,0,1,0 };//左 下 右 上int next_x;int next_y;for (int i = 0; i < n * n - 1; i++){grid[x][y] = current--;next_x = x + dx[dir];next_y = y + dy[dir];if (next_x < 0 || next_x >= n || next_y < 0 || next_y >= n || grid[next_x][next_y] != -1){dir = (dir + 1) % 4;next_x = x + dx[dir];next_y = y + dy[dir];}x = next_x;y = next_y;}grid[n / 2][n / 2] = 0; // 中心位置填0return grid;
}int main() {int t;cin >> t;while (t--){int n;cin >> n;auto grid = constructGrid(n);for (const auto& row : grid) {for (int num : row) {cout << num << " ";}cout << endl;}}return 0;
}

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

相关文章:

  • 智慧团建电脑版登录入口官网爱站网seo综合查询工具
  • 做平台的网站有哪些功能吗郑州seo优化公司
  • 招商网站正在直播足球比赛
  • 中国企业网站建设现状中国站免费推广入口
  • 手机网站开发人员工具求购买链接
  • 网络营销课程培训课程seo搜索引擎优化排名哪家更专业
  • 专门做熟妇的网站谷歌搜索官网
  • 做网站应该问客户什么需求免费的行情网站app
  • 设计师网站prinest武汉seo报价
  • 嘉兴百度网站推广私人网站管理软件
  • 护肤品主题网站怎么做哪家培训机构好
  • php做视频网站有哪些永久免费客服系统软件
  • 怎么上传自己的做网站网络推广招聘
  • 自拟品牌策划方案广州seo网络推广员
  • 小程序模板下载了怎么用网站优化方法
  • 公司建设网站需要去哪报备微信营销软件排行榜
  • 网站漂浮二维码代写文章平台
  • 做外贸开店用哪个网站营销推广策略
  • 新学校网站建设成果查询网入口
  • 前端 兼职做网站谷歌浏览器下载安装
  • 福州企业网站模板建站百度推广代理商赚钱吗
  • 网站建设难么辽宁好的百度seo公司
  • java流媒体网站开发app下载量推广
  • 企业网络策划seo需求
  • 沧州wap网站制作行业网站网址
  • 西安 美院 网站建设公司模板建站
  • 做最关心华人的地方网站电脑培训课程
  • 指纹定制网站seo排名优化软件免费
  • 做基因互作的网站站长工具百科
  • 品牌加盟最好的网站建设搜索引擎广告图片