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

arvixe如何做网站百度一下百度搜索百度

arvixe如何做网站,百度一下百度搜索百度,php做网站不兼容ie8,做网站服务器一年多少钱个人主页:Guiat 归属专栏:算法竞赛 文章目录 A. 移动距离(5分填空题)B. 客流量上限(5分填空题)C. 可分解的正整数D. 产值调整E. 画展布置F. 水质检测G. 生产车间H. 装修报价 正文 总共10道题。 A. 移动距离…

在这里插入图片描述

个人主页:Guiat
归属专栏:算法竞赛

在这里插入图片描述

文章目录

  • A. 移动距离(5分填空题)
  • B. 客流量上限(5分填空题)
  • C. 可分解的正整数
  • D. 产值调整
  • E. 画展布置
  • F. 水质检测
  • G. 生产车间
  • H. 装修报价

正文

总共10道题。

A. 移动距离(5分填空题)

【题目】移动距离

【分析】
考察数学。先往右走直线,再走圆弧,即最优解。

【答案】1576

【AC_Code】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;void solve()
{int x = 233, y = 666; double r = sqrt(x * x + y * y);double res = r * (1 + atan2(y, x));cout << fixed << setprecision(0)  << res << '\n';
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

B. 客流量上限(5分填空题)

【题目】客流量上限

【分析】

【答案】781448427

【AC_Code1】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;
using ll = long long; const int mod = 1e9 + 7;int FE(int m, int k, int p)
{ll t = m, res = 1;while (k){if (k & 1) res = res * t % p;k >>= 1; t = t * t % p;}return res;
}void solve()
{cout << FE(2, 1012, mod) << '\n';
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

【AC_Code2】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;const int mod = 1e9 + 7;int pow(int m, int k, int p)
{int res = 1;while (k --) res = res * m % p;return res;
}void solve()
{cout << pow(2, 1012, mod) << '\n';
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

C. 可分解的正整数

【题目】可分解的正整数

【分析】
考察模拟。根据题意,分析出除1以外的任何整数都可以分解。

【AC_Code】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;const int N = 1e5 + 10; int a[N], ans;void solve()
{int n; cin >> n;for (int i = 0; i < n; i ++) { cin >> a[i]; if (a[i] != 1) ans ++; }cout << ans << '\n';
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

D. 产值调整

【题目】产值调整

【分析】
按题意暴力模拟会超时只有30分。“观察到”如果 A, B, C 三个数相同的话再处理还是不改变三个数大小,此时直接跳出循环来节省时间,可以拿到满分。

【AC_Code】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;void solve()
{int T; cin >> T;while (T --){int A, B, C, K; cin >> A >> B >> C >> K;while (K --){int a = A, b = B, c = C;A = (b + c) / 2; B = (a + c) / 2; C = (a + b) / 2;if (A == B && B == C) break;   // 拿满分关键 }cout << A << ' ' << B << ' ' << C << '\n';}
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

E. 画展布置

【题目】画展布置

【分析】

【AC_Code】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;
using ll = long long;const int N = 1e5 + 10; ll a[N], ans = LLONG_MAX;void solve()
{int n, m; cin >> n >> m;for (int i = 0; i < n; i ++) cin >> a[i], a[i] *= a[i];sort(a, a + n);for (int l = 0, r = m - 1; r < n; l ++, r ++) ans = min(a[r] - a[l], ans);cout << ans << '\n';  
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

F. 水质检测

【题目】水质检测

【分析】

【AC_Code】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;void solve()
{string a, b; cin >> a >> b;int last = -1, state = -1, cnt = 0;for (int i = 0; i < a.length(); i ++){if (a[i] == '.' && b[i] == '.') continue;if (last != -1) cnt += i - last - 1;if (a[i] == '#' && b[i] == '#') state = 3;else if (a[i] == '#' && b[i] == '.'){if (state == 2) { cnt ++; state = 3; } else state = 1;}else if (a[i] == '.' && b[i] == '#'){if (state == 1) { cnt ++; state = 3; } else state = 2;}last = i;}cout << cnt << '\n';
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

G. 生产车间

【题目】生产车间

【分析】

【AC_Code】

H. 装修报价

【题目】装修报价

【分析】

【AC_Code1】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;
using ll = long long;const int mod = 1e9 + 7;int s, ans;ll FE(ll a, ll b, ll p)
{ll ans = 1; a %= p;while (b){if (b & 1) ans = (ans * a) % p;b >>= 1; a = (a * a) % p;}return ans % p;
}void solve()
{int n; cin >> n;for (int i = 1; i <= n; i ++){int a; cin >> a; s ^= a;if (i < n) { ans += 2 * s * FE(3ll, n - i - 1, mod) % mod; }else ans += s;ans %= mod;}cout << ans << '\n';
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

【AC_Code2】

#include <bits/stdc++.h>
#define IOS ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);using namespace std;
using ll = long long;const int mod = 1e9 + 7; ll sum, ans;void solve()
{int n; cin >> n;for (int i = 1; i <= n; i ++){int a; cin >> a;ans = (ans * 3 - sum + (sum ^= a) + mod) % mod;}cout << ans << '\n';
}int main()
{IOS int _ = 1;   // cin >> _;while (_ --) solve();return 0;
}

结语
感谢您的阅读!期待您的一键三连!欢迎指正!

在这里插入图片描述

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

相关文章:

  • 网站空间空间租赁怎么弄一个网站
  • 滨海做网站公司关键词排名关键词优化
  • 网站内容页怎么做百度推广费用一年多少钱
  • 湘潭今日头条新闻排名seo公司
  • 有没有公司做农副产品网站的企业如何进行搜索引擎优化
  • 搬瓦工如何搭建做网站南宁网络推广有限公司
  • 自己写的网站如何添加 cnzz统计企业软文营销发布平台
  • 网站收录后怎么做排名学好seo
  • 北京做网站开发公司有哪些百度指数官方版
  • 汉中网站制作济南网络优化网址
  • 定制网站开发系统小红书推广引流
  • 网站建设 宜宾销售平台有哪些
  • 新乡做网站公司哪家好有免费推广平台
  • 广州金融网站设计山西网页制作
  • 上海电商app开发河北百度seo软件
  • 免费招收手游代理内服号百度网站免费优化软件下载
  • 网站备案ip地址段谷歌商店下载安装
  • 企业大型网站开发需要多少钱百度seo服务公司
  • 网站建设分析图24小时人工在线客服
  • 网站建设费 科目百度广告联盟赚广告费
  • 网站开发开源的手册最有效的100个营销方法
  • 做网站具体流程步骤5118营销大数据
  • 花店网站首页模版平台推广公众平台营销
  • 郯城建设局网站怎么开设自己的网站
  • wordpress 流程网站seo诊断分析报告
  • 网站维护 北京云seo
  • 盐城手机网站建设公司网页设计与制作代码成品
  • 浙江苏省城乡建设厅网站高级seo
  • 做网站找毛叶子歌seo策略有哪些
  • 专业科技网站建设产品代理推广方案