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

2025年第八届广西大学生程序设计大赛(正式赛)题解(更新中)

请添加图片描述

知乎评价:如何评价2025年第八届GXCPC广西大学生程序设计大赛暨中国-东盟国际大学生程序设计大赛?

榜单:牛客比赛排名

题目链接:第八届广西大学生程序设计大赛暨2025邀请赛

TIP:提交处可查看别人过题代码

难度签到题普通题中等题难题
题号A D HBE G J K LC F I
情况--

全部资料:一至八届 GXCPC广西大学生程序设计竞赛 题目与题解


文章目录

  • 签到题
  • A. Additive Combinatorics
    • 题目大意:
    • 解题思路:
    • 参考代码c++:
  • D. DeepSeek, DeepThink!
    • 题目大意:
    • 解题思路:
    • 参考代码c++:
  • H. Hollow Knight: Silksong
    • 题目大意:
    • 解题思路:
    • 参考代码c++:
  • 普通题
  • B. Beats
    • 题目大意:
    • 解题思路:
    • 参考代码c++:

签到题

A. Additive Combinatorics

A. Additive Combinatorics

加性组合

题目大意:

判断 C 是否是 A 和 B 的和集

解题思路:

官方题解PPT还没看到

博主补充:

双重循环,计算每一对元素的和,将和存入集合(集合会自动排序和去重)

参考代码c++:

#include<bits/stdc++.h>
using namespace std;int main() {int n1, n2, n3, x;cin >> n1 >> n2 >> n3;vector<int> a(n1), b(n2);for (int &x : a) cin >> x;for (int &x : b) cin >> x;set<int> c;while (n3--) cin >> x, c.insert(x);set<int> temp;for (int i : a) for (int j : b) temp.insert(i + j);cout << (temp == c ? "YES" : "NO");
}

D. DeepSeek, DeepThink!

D. DeepSeek, DeepThink!

深度求索,深度思考!

题目大意:

修改输入的值(开头首字母改小写,末尾?改.),前面拼接一段值,最后输出

解题思路:

官方题解PPT还没看到

博主补充:

没啥好说的,字符串处理方式多种多样

参考代码c++:

#include<bits/stdc++.h>
using namespace std;int main() {string s;getline(cin, s);s.front() = tolower(s.front());s.back() = '.';cout << "Okay, so I want to figure out " << s;
}

H. Hollow Knight: Silksong

H. Hollow Knight: Silksong

空洞骑士:丝之歌

题目大意:

其实就是,计算还有多少天发布游戏

解题思路:

官方题解PPT还没看到

博主补充:

想简化代码有很多种方式,闰年计算可以简化,

参考代码c++:

#include <iostream>
using namespace std;bool is_leap(int year) {return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}int main() {int y, m, d;cin >> y >> m >> d;const int end_days = 261; // 2025-09-18是当年的第261天int total = 0;// 计算起始日期在当年的天数int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};if (is_leap(y)) days[2] = 29;int start = d;for (int i = 1; i < m; ++i) start += days[i];if (y == 2025) {total = end_days - start;} else {total = (is_leap(y) ? 366 : 365) - start; // 剩余天数for (int yr = y + 1; yr < 2025; ++yr) {  // 中间年份total += is_leap(yr) ? 366 : 365;}total += end_days; // 加上2025年的天数}cout << total << endl;return 0;
}

普通题

B. Beats

B. Beats

节拍

题目大意:

每个节拍开始的瞬间,不能有某个音符正在播放但还没有结束

解题思路:

官方题解PPT还没看到

博主补充:

记录前缀和,然后循环里判断(前缀和的写法可以优化)

参考代码c++:

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,a[200010],s[200010];
map<int,bool>m;
signed main(){cin>>n;for(int i=1;i<=n;i++)cin>>a[i],s[i]=s[i-1]+a[i],m[s[i]]=1;for(int i=1;i<=n;i++){int k=s[i];for(int j=2;;j++){if(k*j>=s[n]){cout<<k;return 0;}if(!m.count(k*j))break;}}
}

http://www.xdnf.cn/news/644995.html

相关文章:

  • Java反射详解
  • 竞赛小算法总结(一):位运算,因数分解和“马拉车”算法含代码详解
  • C#学习
  • 有限时间 vs 固定时间 vs 预定时间滑模:稳定性分析与仿真验证方法对比(下)
  • leetcode 17. Letter Combinations of a Phone Number
  • MD5+盐保存密码
  • 用VMWare架飞牛nas 启用Intel千兆网卡
  • 人工智能导论复习 第一、二章
  • 从零开始上传预印版论文到 arXiv
  • SciPy是什么?是一个开源的 Python 算法库和数学工具包
  • 怎么判断股指期货空头增仓和多头增仓呢?
  • C++ 定义一个结构体,用class还是struct
  • DAY35作业
  • AI 赋能心理健康预测与干预:智能技术如何成为情绪“守护者”
  • 【分库分表】理论基础
  • Python训练营打卡Day36
  • YOLO11解决方案之区域追踪探索
  • Python二级考试
  • SOC-ESP32S3部分:12-1、任务通信-队列
  • 类和对象简要小记
  • 大模型应用开发之RAG
  • 【python】OOP编程从0到1
  • 前端常见的安全问题
  • 【监控】Node Exporter 介绍及应用
  • QT6安装与概念介绍
  • 30字速成Docker安装与配置指南
  • 【Web前端】ECMAScript 6基础学习
  • HTTP协议版本的发展(HTTP/0.9、1.0、1.1、2、3)
  • MySQL并发事务问题及隔离级别演示
  • 蓝桥杯单片机答题技巧