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

广州品牌网站建设公司平台搭建

广州品牌网站建设公司,平台搭建,成品源码1688网站免费,网站建设的问题前言 题解 2021 RoboCom 世界机器人开发者大赛-高职组(复赛)解题报告。 模拟题为主,包含进制转换等等。 最后一题,是对向量/自定义类型,重定义小于操作符。 7-1 人工智能打招呼 分值: 15分 考察点: 分支判定&…

前言

在这里插入图片描述


题解

2021 RoboCom 世界机器人开发者大赛-高职组(复赛)解题报告。

模拟题为主,包含进制转换等等。

最后一题,是对向量/自定义类型,重定义小于操作符。

在这里插入图片描述

7-1 人工智能打招呼

分值: 15分

考察点: 分支判定,判重技巧

#include <bits/stdc++.h>using namespace std;int main() {int n;cin >> n;set<string> hp;for (int i = 0; i < n; i++) {string id; cin >> id;if (hp.find(id) == hp.end()) {cout << "Hello " << id << ", how are you?\n";hp.insert(id);} else {cout << "Hi " << id<< "! Glad to see you again!\n";}}return 0;
}

7-2 人工智能数字翻译

分值: 20分
考察:进制转换,10和27进制互转

在这里插入图片描述

#include <bits/stdc++.h>using namespace std;int main() {string a;int d;cin >> a >> d;if (d == 10) {string res;int s = stoi(a);while (s > 0) {int r = s % 27;if (r >= 0 && r < 10) {res += (char)(r + '0');} else {res += (char)(r - 10 + 'A');}s /= 27;}if (res.empty()) res = "0";reverse(res.begin(), res.end());// 去掉前置多余的0if (res[0] == '0' && res.size() > 0) {int pos = res.size() - 1;for (int i = 0; i < res.size(); i++) {if (res[i] != '0') {pos = i;break;}}res = res.substr(pos);}cout << res << "\n";} else {int64_t res = 0;string s = a;for (char c: s) {if (c >= '0' && c <= '9') {res = res * 27 + (c - '0');} else {res = res * 27 + (c - 'A' + 10);}}cout << res << "\n";}return 0;
}

7-3 机器人拼图

分值: 20分

模拟
在这里插入图片描述


#include <bits/stdc++.h>using namespace std;int main() {int n, m;cin >> n >> m;vector<vector<int>> mat(n, vector<int>(m, 0));for (int i = 0; i < n * m; i++) {string op; cin >> op;int x = 0, y = 0;for (char c: op) {if (c == '1') {y = min(y + 1, m - 1);} else if (c == '3') {y = max(y - 1, 0);} else if (c == '2') {x = min(x + 1, n - 1);} else if (c == '4') {x = max(x - 1, 0);} else {if (mat[x][y] == 0) {mat[x][y] = i + 1;}}}}for (int i = 0; i < n; i++) {for (int j = 0; j < m; j++) {cout << mat[i][j] << " \n"[j == m - 1];}}return 0;
}

7-4 PAT基础级排名

分值: 20分

思路: 排序 + 分组循环

因为存在同分的情况,所以分组循环,是种优雅的写法

#include <bits/stdc++.h>using namespace std;struct Stu {string name;int score;
};int main() {int n, L;cin >>n >> L;vector<Stu> arr;for (int i = 0; i < n; i++) {Stu stu;cin >> stu.name >> stu.score;arr.push_back(stu);}sort(arr.begin(), arr.end(), [](auto &a, auto &b) {if (a.score != b.score) return a.score > b.score;return a.name < b.name;});int levels[6] = {0, 30, 50, 60, 80, 100}; auto resolve = [levels](int a) {for (int i = 5; i >= 0; i--) {if (a > levels[i]) return i + 1;}return 0;};int x = L + 1;int m = n;int acc = 0;int rank = 0;for (int i = 0;i < n; i++) {Stu &stu = arr[i];int level = resolve(stu.score);if (x > level) {m = m - acc;acc = 0;x = level;rank = 1;}acc++;if (acc > 1 && arr[i].score == arr[i - 1].score) {} else {rank = acc;}if (x != 0) {cout << stu.name << " " << x << " " << stu.score << "/" << levels[x] << " "<< rank << "/" << m << "\n";} else {cout << stu.name << "\n";}}return 0;
}

7-5 人工智能刑警

分值: 25分

思路: 自定义类型重定义小于操作符

因为这边采用map(底层是树),所以需要对自定义类型重定义小于操作符。

#include <bits/stdc++.h>using namespace std;struct T {vector<int> feature;bool operator<(const T&lhs) const {int n = feature.size();for (int i = 0; i < n; i++) {int v1 = feature[i], v2 = lhs.feature[i];if (v1 != v2) return v1 < v2;}return 0;}
};int main() {map<T, string> hp;int n, f;cin >> n >> f;for (int i = 0; i < n; i++) {T t;for (int j = 0; j < f; j++) {int v; cin >> v;t.feature.push_back(v);}string name; cin >> name;hp[t] = name;}while (true) {bool ok = true;T t2;for (int i = 0; i < f; i++) {int v; if (cin >> v && (v == 0 && i == 0)) {ok = false;break;}t2.feature.push_back(v);}if (!ok) break;if (hp.find(t2) != hp.end()) {cout << hp[t2] << "\n";} else {cout << "Pass"  << "\n";}}return 0;
}

写在最后

在这里插入图片描述

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

相关文章:

  • 网站模版下载seo网站的优化方案
  • 建站收费标准seo搜索引擎优化工资多少钱
  • wordpress 表格提交seo优化推广专员招聘
  • 建立网站的基本流程seo的工作原理
  • bootstrap网站模板导航营销型网站建设要点
  • 高端品牌网站建设公司直播:英格兰vs法国
  • 怎样在网上做环保设备网站自动交换友情链接
  • 西安官网制作湖南优化公司
  • 哈尔滨网站建设咨询百度广告点击软件源码
  • 哪些做网站的公司百度软件下载
  • 网站禁用右键培训机构seo
  • 找人做网站域名怎么过户seo助手
  • 做网站头视频账号权重查询入口
  • txt怎么做pdf电子书下载网站产品推广运营的公司
  • 三合一网站建设多少钱百度关键词热度查询
  • 网站解析后怎么做seo观察网
  • .net网站开发岗位2345网址导航
  • 有没有教做网站实例视频网络营销心得体会300字
  • 无需下载的网站广东疫情最新消息今天又封了
  • 山西建站管理系统开发网络推广是以企业产品或服务
  • 用手机建网站爱站在线关键词挖掘
  • 嘉兴网站制作怎么添加按钮奉化网站关键词优化费用
  • 网站上实用的h5特效保定网站seo
  • 简述网站开发的步骤seo课程培训课程
  • 公司做网站最好地推的方法和技巧
  • 广西网站建设运营费用抖音搜索引擎优化
  • 武汉站设计单位四川seo选哪家
  • 深圳网站优化培训外贸seo推广招聘
  • 广告制作包括哪些seochinaz查询
  • 如何做制作头像的网站互联网营销推广渠道