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-编程技能赛-本科组(省赛)的更多相关文章

  1. 2015游戏蛮牛——蛮牛杯第四届开发者大赛 创见VR未来开启报名

    蛮牛杯启动了,大家开始报名! http://cup.manew.com/ 这不是一篇普通的通稿,别着急忽略它.它是一篇可以让你梦想变现的通稿! 从某一天开始,游戏蛮牛就立志要为开发者服务,我们深知这一 ...

  2. 国内第一本micropython的书出版《机器人Python极客编程入门与实战》

    第一本micropython的书<机器人Python极客编程入门与实战>. 购买地址:https://item.taobao.com/item.htm?spm=2013.1.w4018-1 ...

  3. 2014年spark开发者大赛火热进行中!

    “发现最有正能量的网络达人”,Spark开发者大赛火热进行! 2014年9月30日,2014 Spark开发者大赛在北京正式启动.本次大赛由Spark亚太研究院联合国内领先的IT技术创新与发展的互联网 ...

  4. 这里有40条提升编程技能小妙招!还有TIOBE 7月份的编程语言排行榜

    如何提高编程技能?恐怕很多开发者思考过这个问题.最近,拥有将近 15 年开发经验的软件工程师 Kesk -*- 写了一篇博客,列举了 40 条对其职业生涯有所帮助的事项.   或许,通过以下 40 个 ...

  5. 那些在GitHub能提高你的编程技能的项目

    1.免费的编程书籍 免费的开发手册 167K Repo:github.com/EbookFoundation/free-programming.. 2. 很棒的话题 包含了各种有趣的话题 148k R ...

  6. 现代Web应用开发者必备的六大技能

    过去,应用开发需要注重大量的专业知识,程序员只需关注单一的语言(比如COBOL.RPG.C++等),并利用该语言创建应用.而如今,时代在变迁.Web不再是单单关注独立的一面.相反,一个现代化的Web应 ...

  7. 给 JavaScript 开发者讲讲函数式编程

    本文译自:Functional Programming for JavaScript People 和大多数人一样,我在几个月前听到了很多关于函数式编程的东西,不过并没有更深入的了解.于我而言,可能只 ...

  8. 开发者大赛 | aelf轻型DApp开发训练大赛结果公布!

    6月9日,由aelf基金会发起的轻型DApp开发训练大赛圆满收官.本次训练赛基于aelf公开测试网展开,主要针对轻型DApp,旨在激励更多的开发者参与到aelf生态中来. 活动于4月21日上线后,ae ...

  9. 2018百度之星开发者大赛-paddlepaddle学习(二)将数据保存为recordio文件并读取

    paddlepaddle将数据保存为recordio文件并读取 因为有时候一次性将数据加载到内存中有可能太大,所以我们可以选择将数据转换成标准格式recordio文件并读取供我们的网络利用,接下来记录 ...

  10. 2018百度之星开发者大赛-paddlepaddle学习

    前言 本次比赛赛题是进行人流密度的估计,因为之前看过很多人体姿态估计和目标检测的论文,隐约感觉到可以用到这次比赛上来,所以趁着现在时间比较多,赶紧报名参加了一下比赛,比赛规定用paddlepaddle ...

随机推荐

  1. uniapp+thinkphp5实现微信扫码支付(APP支付)

    前言 统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返回预支付订单号的接口,目前微信支付所有场景均使用这一接口.下面介绍的是其中APP的支付的配置与实现流程 配置 1.首先登录 ...

  2. 3568F-Linux应用开发手册

       

  3. Python脚本报错:DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working import pymssql

    报错信息: monitor_mssql.py:10: DeprecationWarning: Using or importing the ABCs from 'collections' instea ...

  4. VS2017 error CS0234: 命名空间“Microsoft”中不存在类型或命名空间名“Office”问题的一种解决方案

    最近需要使用VS2017编辑C#,但在编译时软件报错:error CS0234: 命名空间"Microsoft"中不存在类型或命名空间名"Office" 在网上 ...

  5. Spring的全局(统一)异常处理

    异常处理的三种方式 使用 @ExceptionHandler 注解 实现 HandlerExceptionResolver 接口(SpringMVC) 使用 @RestControllerAdvice ...

  6. PHP+Redis 实例【一】点赞 + 热度

    前言 点赞其实是一个很有意思的功能.基本的设计思路有大致两种, 一种自然是用mysql(写了几百行的代码都还没写完,有毒)啦 数据库直接落地存储, 另外一种就是利用点赞的业务特征来扔到redis(或m ...

  7. iOS开发基础135-Core Data

    Objective-C (OC) 中使用 Core Data 是iOS应用开发中管理模型层对象的一种有效工具.Core Data 使用 ORM (对象关系映射) 技术来抽象化和管理数据.这不仅可以节省 ...

  8. 服务端渲染中的数据获取:结合 useRequestHeaders 与 useFetch

    title: 服务端渲染中的数据获取:结合 useRequestHeaders 与 useFetch date: 2024/7/24 updated: 2024/7/24 author: cmdrag ...

  9. Appium Appium Python API 中文版

    1.contextscontexts(self): Returns the contexts within the current session. 返回当前会话中的上下文,使用后可以识别H5页面的控 ...

  10. php 选择驱动写法

    在 ThinkPHP 5.1 中,若要根据配置文件 sms.conf 中的设置在不同的短信渠道之间进行切换,可以采用以下步骤: 第一步:定义接口 首先,创建一个接口,这个接口将由所有短信渠道类实现.这 ...