当前位置:网站首页>2021 RoboCom 世界机器人开发者大赛-高职组复赛
2021 RoboCom 世界机器人开发者大赛-高职组复赛
2022-07-01 22:54:00 【Alan_Lowe】
2021 RoboCom
世界机器人开发者大赛-高职组复赛
文章目录
前言
比赛的时候老师总是说,你们连高职都打不过。
题目都很简单,就直接贴一下代码吧。
1.人工智能打招呼
AC代码
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
set<string> s;
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n;
while (n--){
string ss;
cin>>ss;
if (s.count(ss))
cout<<"Hi "<<ss<<"! Glad to see you again!\n";
else
cout<<"Hello "<<ss<<", how are you?\n",s.insert(ss);
}
return 0;
}
2.人工智能数字翻译
AC代码
#include<bits/stdc++.h>
using namespace std;
#define int long long
string a;int d;
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>a>>d;
if (d == 10){
string s = "";
int k = 1,num = 0;
for (int i = a.length() - 1; i >= 0; --i) {
num += k * (a[i] - '0');
k *= 10;
}
if (num == 0){
cout<<"0";
return 0;
}
while (num){
if (num % 27 < 10)
s.insert(s.begin(),'0' + num % 27);
else
s.insert(s.begin(),num % 27 - 10 + 'A');
num /= 27;
}
cout<<s;
}
else{
int k = 1,num = 0;
for (int i = a.length() - 1; i >= 0; --i) {
if (a[i] <= '9')
num += k * (a[i] - '0');
else
num += k * (a[i] - 'A' + 10);
k *= 27;
}
cout<<num;
}
return 0;
}
3.机器人拼图
AC代码
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
int note[105][105];
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n>>m;
for (int i = 1; i <= n * m; ++i) {
string s;cin>>s;
int x = 1,y = 1;
for (int j = 0; j < s.length(); ++j) {
switch (s[j]) {
case '1':
y += 1;y = min(y,m);break;
case '2':
x += 1;x = min(x,n);break;
case '3':
y -= 1;y = max((long long)1,y);break;
case '4':
x -= 1;x = max((long long)1,x);break;
default:
if (!note[x][y])
note[x][y] = i;
break;
}
}
}
for (int i = 1; i <= n; ++i) {
cout<<note[i][1];
for (int j = 2; j <= m; ++j) {
cout<<" "<<note[i][j];
}
cout<<"\n";
}
return 0;
}
4.PAT
基础级排名
AC代码
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define psi pair<string,int>
int n,m;
int score[6] = {
0,30,50,60,80,100};
vector<psi> v[6];
bool cmp(psi a,psi b){
if (a.second == b.second)
return a.first < b.first;
return a.second > b.second;
}
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n>>m;
for (int i = 0; i < n; ++i) {
string s;int sco;
cin>>s>>sco;
if (sco > 80)
v[5].push_back(psi(s,sco));
else if (sco > 60)
v[4].push_back(psi(s,sco));
else if (sco > 50)
v[3].push_back(psi(s,sco));
else if (sco > 30)
v[2].push_back(psi(s,sco));
else
v[1].push_back(psi(s,sco));
}
for (int i = 1; i <= 5; ++i)
sort(v[i].begin(),v[i].end(),cmp);
for (int i = m; i >= 1; --i) {
int now = 1,now_bl = 0,sum = 0;
for (int j = i; j >= 1; --j)
sum += v[j].size();
for (int j = 0; j < v[i].size(); ++j) {
if (v[i][j].second == 0){
cout<<v[i][j].first<<"\n";
continue;
}
if (j == 0){
cout<<v[i][j].first<<" "<<i<<" "<<v[i][j].second<<"/"<<score[i]<<" "<<now<<"/"<<sum<<"\n";
}
else{
if (v[i][j].second == v[i][j - 1].second){
cout<<v[i][j].first<<" "<<i<<" "<<v[i][j].second<<"/"<<score[i]<<" "<<now<<"/"<<sum<<"\n";
now_bl += 1;
}
else{
now += 1 + now_bl;now_bl = 0;
cout<<v[i][j].first<<" "<<i<<" "<<v[i][j].second<<"/"<<score[i]<<" "<<now<<"/"<<sum<<"\n";
}
}
}
}
return 0;
}
5.人工智能刑警
AC代码
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m,a;
vector<int> v;string s;
map<vector<int>,string> mp;
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n>>m;
for (int i = 0; i < n; ++i) {
v.clear();
for (int j = 0; j < m; ++j) {
cin>>a;v.push_back(a);
}
cin>>s;
mp[v] = s;
}
while (1){
v.clear();
for (int i = 0; i < m; ++i) {
cin>>a;v.push_back(a);
}
if (v[0] == 0)
break;
if (mp[v] == "")
cout<<"Pass\n";
else
cout<<mp[v]<<"\n";
}
return 0;
}
边栏推荐
- 想请教股票开户要认识谁?在线开户是安全么?
- Wechat personal small store one click opening assistant applet development
- What professional classification does the application of Internet of things technology belong to
- Summary of "performance testing" of software testing, novice will know the knowledge points on the road
- plain framework的实际应用和扩展
- What is mosaic?
- 每日三题 6.28
- 物联网现状及未来发展趋势
- Is it safe to choose mobile phone for stock trading account opening in Shanghai?
- 关于游戏性能优化的一些感想
猜你喜欢
Distance measurement - Hamming distance
Redis~02 cache: how to ensure data consistency in MySQL and redis when updating data?
What is the mosaic tailgate?
“35岁,公司老总,月薪2万送外卖“:时代抛弃你,连声再见都没有
Commemorate becoming the first dayus200 tripartite demo contributor
2022安全员-C证考试题模拟考试题库及模拟考试
Jerry's records are powered by Vbat with a power supply voltage of 4.2V [chapter]
CKS CKA ckad change terminal to remote desktop
微信个人小商店一键开通助手小程序开发
神经网络物联网的发展趋势和未来方向
随机推荐
You probably haven't noticed the very important testing strategy in your work
Zhao Fuquan: to ensure supply in the short term, we should build a safe, efficient and resilient supply chain in the long term
[MySQL] basic use of explain and the function of each column
Linux基础 —— CentOS7 离线安装 MySQL
Matplotlib常用設置
openresty 负载均衡
[MySQL] database optimization method
2022 safety officer-c certificate examination question simulation examination question bank and simulation examination
Is it safe to choose mobile phone for stock trading account opening in Shanghai?
Detailed explanation of twenty common software testing methods (the most complete in History)
Understanding threads
微信个人小商店一键开通助手小程序开发
Matplotlib常用图表
De PIP. Interne. CLI. Main Import main modulenotfounderror: No module named 'PIP'
vim给目录加颜色
Rank ranking with MySQL 5.7
What is the difference between memory leak and memory overflow?
Force buckle 710 Random numbers in the blacklist
共享电商的背后: 共创、共生、共享、共富,共赢的共富精神
Commemorate becoming the first dayus200 tripartite demo contributor