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

2025ICPC南昌邀请赛题解

出题组:XDU & WHU。
第一题是主办方加的签到题。邀请赛榜单8题金,6题手快可以银,五题铜,榜单:ICPC南昌邀请赛榜单。


A. Nezha Naohai

只要不是想当然都乘起来应该不会错的, ( a + b + c ) × d (a+b+c) \times d (a+b+c)×d

#include <bits/stdc++.h>
#define x first
#define y second
#define int long longusing namespace std;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
const int N = 100010, M = N * 2, mod = 1e9 + 7, P = 131;void solve()
{int a, b, c, d;cin >> a >> b >> c >> d;cout << (a + b + c) * d << "\n";
}signed main()
{std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);int t = 1;// cin >> t;while (t--)solve();return 0;
}
K. Rotation

一开始读成了操作一是当前这个不动,喜提wa。
这道题应该这样来看,先执行操作一,将所有的统一成一个方向再执行操作二。
所以先按顺时针统一方向,这一步需要mp[(i + 1) % 4] + 2 * mp[(i + 2) % 4] + 3 * mp[(i + 3) % 4]步操作,最后再将统一的方法执行操作二转到方向0。

#include <bits/stdc++.h>
#define x first
#define y second
#define int long longusing namespace std;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
const int N = 1000010, M = N * 2, mod = 1e9 + 7, P = 131;
int n;
int a[N];void solve()
{cin >> n;map<int, int> mp;for (int i = 1; i <= n; i++)cin >> a[i], mp[a[i]]++;int res = 1e18;for (int i = 0; i < 4; i++){int s = mp[(i + 1) % 4] + 2 * mp[(i + 2) % 4] + 3 * mp[(i + 3) % 4];int j = (i + s) % 4;if (j != 0)s += (4 - j);res = min(res, s);}cout << res << "\n";
}signed main()
{std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);int t = 1;// cin >> t;while (t--)solve();return 0;
}
M. Divide coins

构造题,前k个给1,后面n-k个全部翻转给2。

#include <bits/stdc++.h>
#define x first
#define y second
#define int long longusing namespace std;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;
const int N = 1000010, M = N * 2, mod = 1e9 + 7, P = 131;
int n, k;void solve()
{cin >> n >> k;for (int i = 1; i <= n; i++)if (i <= k)cout << "1";elsecout << "4";
}signed main()
{std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);int t = 1;// cin >> t;while (t--)solve();return 0;
}

剩下的后面补。

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

相关文章:

  • 基于规则引擎与机器学习的智能Web应用防火墙设计与实现
  • 【数据库课程设计】网上投票管理系统
  • 阿博图书馆管理系统 Java+Spring Boot+MySQL 实战项目分享
  • leetcode hot100:一、解题思路大全:技巧(只出现一次的数字、多数元素、颜色分类、下一个排列、寻找重复数)、矩阵(矩阵置零、螺旋矩阵、旋转图像、搜索二维矩阵Ⅱ)
  • ArkUI Tab组件开发深度解析与应用指南
  • setInterval和setTimeout的区别是什么
  • 【java第18集】java引用数据类型详解
  • Q-learning 算法学习
  • JUC入门(三)
  • FAL API分析
  • 工会考试怎么备考
  • 如何确保低空经济中的数据安全?
  • 斜齿轮直列齿轮箱市场分析报告:驱动因素、挑战及前景预测
  • WAF深度解析:精准适配六大核心业务场景
  • Python实现的在线词典学习工具
  • JQuery 禁止页面滚动(防止页面抖动)
  • 测试开发面试题:Python高级特性通俗讲解与实战解析
  • 数据可视化热图工具:Python实现CSV/XLS导入与EXE打包
  • 软件设计师完整性约束考点分析——求三连
  • antd树结构
  • Java常见API文档(下)
  • matlab绘制光学传递函数mtf曲线
  • Pattern解说
  • CPU与vivado编译速度关系
  • C++_AVL树
  • vue2.0 的计算属性
  • 人员管理2302版本
  • 特征筛选方法总结
  • frida 配置
  • Linux基础开发工具三(git,gdb/cgdb)