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 ...
随机推荐
- 闲鱼面试:说说JWT工作原理?
JWT(JSON Web Token)一种开放的标准规范(RFC 7519),用于在网络上安全的传输信息,通常被用于身份验证. 简单来说,你可以把 JWT 想象成一张小巧的.自包含的电子通行证.这张通 ...
- 【FAQ】HarmonyOS SDK 闭源开放能力 —Ads Kit
1.问题描述: 开屏广告效果最好的实现方式? 解决方法: 1.动画效果和开发者的实现方式有关,和开屏广告页面本身没什么关系的: 2.示例代码中使用Router跳转的方式展示广告,主要是用于演示广告接口 ...
- Linux 内核:设备驱动模型(5)平台设备驱动
Linux 内核:设备驱动模型(5)平台设备驱动 背景 我们已经大概熟悉了Linux Device Driver Model:知道了流程大概是怎么样的,为了加深对LDDM框架的理解,我们继续来看pla ...
- logo2
- Js 中的数组
在js 中,数组就是对象,除了可以使用字面量语法[...]来声明数组外,它和其它对象没有什么区别.当创建一个数组['a', 'b', 'c']时,内部的实现形式如下: { length: 3, ...
- springboot 整合 pagehelper
pom.xml <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pa ...
- iOS开发基础99-内购in_app
今天后台支付校验模块报错,拿到凭证去苹果校验返回的结果如下: { "receipt": { "receipt_type": "Production&q ...
- oeasy教您玩转vim - 35 - # 正则表达
查找进阶 回忆上节课内容 实时搜索 :set incsearch 大写小写 ignorecase 查找当前单词 * 正向按单词 # 反向按单词 g* 正向不按单词 g# 反向不按单词 继续查找 n ...
- 深入探究 Golang 反射:功能与原理及应用
Hi 亲爱的朋友们,我是 k 哥.今天,咱们来一同探讨下 Golang 反射. Go 出于通用性的考量,提供了反射这一功能.借助反射功能,我们可以实现通用性更强的函数,传入任意的参数,在函数内通过反射 ...
- Python 利用argparse模块实现脚本命令行参数解析
利用argparse模块实现脚本命令行参数解析 By:授客 QQ:1033553122 #代码实践1 study.py内容如下 #!/usr/bin/env python # -*- coding:u ...