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

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.dtcms.com/a/203143.html

相关文章:

  • 记录学习的第三十六天
  • ZYNQ Cache一致性问题解析与实战:从原理到创新优化
  • PEFT简介及微调大模型DeepSeek-R1-Distill-Qwen-1.5B
  • mysql不能聚合之数据清洗逗号
  • 第7天-Python+PyEcharts实现股票分时图实战教程
  • OD 算法题 B卷 【需要打开多少监视器】
  • 算法打卡第一天
  • 每日算法刷题Day10 5.19:leetcode不定长滑动窗口求最长/最大4道题,结束定长滑动窗口,用时1h
  • 大模型的开发应用(三):基于LlaMAFactory的LoRA微调(上)
  • CSS之box-sizing、图片模糊、计算盒子宽度clac、(重点含小米、进度条案例)过渡
  • 再议AOI算法
  • 谈谈mysql的日志的用途
  • Google精准狙击OpenAI Codex,发布AI编程助手Jules!
  • Kubernetes在线练习平台深度对比:KillerCoda与Play with Kubernetes
  • Rofin PowerLine E Air维护和集成手侧激光Maintenance and Integration Manual
  • 本地ip如何映射到外网?借助端口映射软件把内网地址给别人用
  • Python 包管理工具核心指令uv sync解析
  • 学习STC51单片机08(芯片为STC89C52RC)
  • 五、central cache的设计
  • unity XCharts插件生成曲线图在UICanvas中
  • TrollStore(巨魔商店)的由来介绍
  • 山东大学计算机图形学期末复习完结篇上——24历年题
  • CAU数据库class3 关系型数据库基础
  • 2001-2023年上市公司管理讨论与分析文本数据(MDA文本数据)
  • 【算法】定长滑动窗口5.20
  • 十五、面向对象底层逻辑-BeanDefinitionRegistryPostProcessor接口设计
  • 瀚高安全版4.5.8/4.5.9字符串默认按字节存储导致数据无法写入(APP)
  • Python 包管理工具uv依赖分组概念解析
  • [ 计算机网络 ] 深入理解OSI七层模型
  • 数据库分库分表从理论到实战