2024 睿抗机器人开发者大赛CAIP-编程技能赛-本科组(省赛)
2024 睿抗机器人开发者大赛CAIP-编程技能赛-本科组(省赛)
RC-u1 热҈热҈热҈
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,w;
cin >> n >> w;
int ans1 = 0, ans2 = 0;
for(int i = 0;i < n;i ++){
int x;
cin >> x;
if(x >= 35){
if(w == 4) ans2 ++;
else ans1 ++;
}
w ++;
if(w > 7) w = 1;
}
cout << ans1 << ' ' << ans2 << '\n';
return 0;
}
RC-u2 谁进线下了?
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
int level(int x){
if(x == 1) return 12;
if(x == 2) return 9;
if(x == 3) return 7;
if(x == 4) return 5;
if(x == 5) return 4;
if(x <= 7) return 3;
if(x <= 10) return 2;
if(x <= 15) return 1;
return 0;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(20);
for(int i = 0;i < n;i ++){
for(int j = 0;j < 20;j ++){
int c,p;
cin >> c >> p;
a[j] += level(c) + p;
}
}
for(int i = 0;i < 20;i ++){
cout << i + 1 << ' ' << a[i] << '\n';
}
return 0;
}
RC-u3 暖炉与水豚
思路
标记暖气周围,当一只水豚周围没有暖气时,说明它周围都有可能是隐藏的暖气,但是要注意判断不在冷水豚的周围。
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<string> s(n);
for (auto &i : s)
cin >> i;
vector st(n, vector<int>(m));
const int u[] = {1, 1, 1, -1, -1, -1, 0, 0};
const int v[] = {1, 0, -1, 1, 0, -1, 1, -1};
for (int i = 0; i < n; i ++)
for (int j = 0; j < m; j ++)
if (s[i][j] == 'm') {
st[i][j] = 1;
for (int k = 0; k < 8; k ++) {
int x = i + u[k], y = j + v[k];
if (x >= 0 && x < n && y >= 0 && y < m)
st[x][y] = 1;
}
}
for (int i = 0; i < n; i ++)
for (int j = 0; j < m; j ++)
if (s[i][j] == 'c') {
st[i][j] = 2;
for (int k = 0; k < 8; k ++) {
int x = i + u[k], y = j + v[k];
if (x >= 0 && x < n && y >= 0 && y < m)
st[x][y] = 2;
}
}
vector<array<int, 2>> ans;
for (int i = 0; i < n; i ++)
for (int j = 0; j < m; j ++)
if (s[i][j] == 'w' && st[i][j] == 0) {
for (int k = 0; k < 8; k ++) {
int x = i + u[k], y = j + v[k];
if (x >= 0 && x < n && y >= 0 && y < m && s[x][y] == '.' && st[x][y] != 2)
ans.push_back({x + 1, y + 1});
}
}
sort(ans.begin(), ans.end());
if (ans.empty()) cout << "Too cold!\n";
else
for (auto &[x, y] : ans)
cout << x << ' ' << y << '\n';
return 0;
}
RC-u4 章鱼图的判断
思路
dfs 判环是否只有一个,用个时间戳记录一下环的个数即可。
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;
vector g(n + 1, vector<int>());
for (int i = 0; i < m; i ++) {
int u, v;
cin >> u >> v;
g[u].push_back(v);
g[v].push_back(u);
}
int ans = 0, cnt = 0, huan = 0;
vector<int> vis(n + 1);
auto dfs = [&](auto & self, int u, int fa, int num)->void{
vis[u] = num;
for (auto v : g[u]) {
if (v == fa) continue;
if (vis[v]) {
cnt ++;
ans = max(ans, num - vis[v] + 1);
} else
self(self, v, u, num + 1);
}
};
for (int i = 1; i <= n; i ++) {
cnt = 0;
if (!vis[i]) {
dfs(dfs, i, 0, 1);
huan += (cnt / 2 == 1);
}
}
if (huan == 1 && n > 2) {
cout << "Yes" << ' ' << ans << '\n';
} else {
cout << "No" << ' ' << huan << '\n';
}
}
return 0;
}
RC-u5 工作安排
思路
按截至日期排个序,然后就是典型的 01 背包。
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
struct node{
int t,d,p;
};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<node> a(n);
for(auto &i : a)
cin >> i.t >> i.d >> i.p;
sort(a.begin(),a.end(),[](node x,node y){
return x.d < y.d;
});
const int N = 5000;
vector<i64> dp(N + 10,INT_MIN);
dp[0] = 0;
for(int i = 0;i < n;i ++){
for(int j = a[i].d;j>=a[i].t;j--)
dp[j] = max(dp[j],dp[j-a[i].t]+a[i].p);
}
i64 ans = 0;
for(int i = 0;i <= N;i ++)
ans = max(ans,dp[i]);
cout << ans << '\n';
}
return 0;
}
2024 睿抗机器人开发者大赛CAIP-编程技能赛-本科组(省赛)的更多相关文章
- 2015游戏蛮牛——蛮牛杯第四届开发者大赛 创见VR未来开启报名
蛮牛杯启动了,大家开始报名! http://cup.manew.com/ 这不是一篇普通的通稿,别着急忽略它.它是一篇可以让你梦想变现的通稿! 从某一天开始,游戏蛮牛就立志要为开发者服务,我们深知这一 ...
- 国内第一本micropython的书出版《机器人Python极客编程入门与实战》
第一本micropython的书<机器人Python极客编程入门与实战>. 购买地址:https://item.taobao.com/item.htm?spm=2013.1.w4018-1 ...
- 2014年spark开发者大赛火热进行中!
“发现最有正能量的网络达人”,Spark开发者大赛火热进行! 2014年9月30日,2014 Spark开发者大赛在北京正式启动.本次大赛由Spark亚太研究院联合国内领先的IT技术创新与发展的互联网 ...
- 这里有40条提升编程技能小妙招!还有TIOBE 7月份的编程语言排行榜
如何提高编程技能?恐怕很多开发者思考过这个问题.最近,拥有将近 15 年开发经验的软件工程师 Kesk -*- 写了一篇博客,列举了 40 条对其职业生涯有所帮助的事项. 或许,通过以下 40 个 ...
- 那些在GitHub能提高你的编程技能的项目
1.免费的编程书籍 免费的开发手册 167K Repo:github.com/EbookFoundation/free-programming.. 2. 很棒的话题 包含了各种有趣的话题 148k R ...
- 现代Web应用开发者必备的六大技能
过去,应用开发需要注重大量的专业知识,程序员只需关注单一的语言(比如COBOL.RPG.C++等),并利用该语言创建应用.而如今,时代在变迁.Web不再是单单关注独立的一面.相反,一个现代化的Web应 ...
- 给 JavaScript 开发者讲讲函数式编程
本文译自:Functional Programming for JavaScript People 和大多数人一样,我在几个月前听到了很多关于函数式编程的东西,不过并没有更深入的了解.于我而言,可能只 ...
- 开发者大赛 | aelf轻型DApp开发训练大赛结果公布!
6月9日,由aelf基金会发起的轻型DApp开发训练大赛圆满收官.本次训练赛基于aelf公开测试网展开,主要针对轻型DApp,旨在激励更多的开发者参与到aelf生态中来. 活动于4月21日上线后,ae ...
- 2018百度之星开发者大赛-paddlepaddle学习(二)将数据保存为recordio文件并读取
paddlepaddle将数据保存为recordio文件并读取 因为有时候一次性将数据加载到内存中有可能太大,所以我们可以选择将数据转换成标准格式recordio文件并读取供我们的网络利用,接下来记录 ...
- 2018百度之星开发者大赛-paddlepaddle学习
前言 本次比赛赛题是进行人流密度的估计,因为之前看过很多人体姿态估计和目标检测的论文,隐约感觉到可以用到这次比赛上来,所以趁着现在时间比较多,赶紧报名参加了一下比赛,比赛规定用paddlepaddle ...
随机推荐
- 认真学习CSS3-问题收集-101号-莫名其妙的row行高
其他人都有事情,有些事情只好自己上阵,自己做,最踏实! 做了两个基本一样的页面,都是采用bootsrap+jquey+js的技术,业务内容就是简单的查询,加上一些简单的效果,没有啥特别的内容. 由于历 ...
- Freertos学习:07-队列
--- title: rtos-freertos-07-队列 EntryName : rtos-freertos-07 date: 2020-06-23 09:43:28 categories: ta ...
- paraview安装
apt 安装 sudo apt install paraview 安装包安装 参考 https://blog.csdn.net/weixin_47492286/article/details/1272 ...
- VS Code Go开发环境配置
1.安装Go 下载网址:https://go.dev/doc/install 根据自己的操作系统来进行安装,官网针对Windows.Linux.macOS都有对应教程.安装完成后打开终端,输入go v ...
- Ubuntu 22.04单机部署K3s
安装docker 从docker官网获取最新的一键安装脚本,安装docker运行环境 curl -fsSL https://get.docker.com -o get-docker.sh sudo s ...
- 3568F-Linux应用开发手册
- bing生成的汉服美女。。
- ChatGPT学习之旅 (8) 单元测试助手
大家好,我是Edison. 本篇我们基于上一篇的基础,来写一个单元测试助手的prompt,让它帮我们写一些我们.NET开发者不太愿意编写的单元测试代码,进而提高我们的代码质量,同时还降低我们的开发工作 ...
- Python入门学习介绍
什么是Python? Python它是一种直译式,面向对象,解释式的脚本语言.它和Java,C/C++,Go语言一样都是高级语言,但由于它是解释式语言,所以运行速度会比Java,C/C++等语言慢(虽 ...
- react为什么不用数组的下标来绑定key
最近在看一本名叫<深入浅出React和Redux>这一书,里面谈到了react的dom更新比对,记录一下. 假设有这么一个组件 <ul> <ListItem text=& ...