Educational Codeforces Round 69 (Rated for Div. 2)

Educational Codeforces Round 69 (Rated for Div. 2)

A - DIY Wooden Ladder

题意:给出不同长度的木棍,求最大能组成多少阶梯的梯子
题解:全部棍子升序排序,找出第二长的,然后其他可以在长度为n的木棍上放下n-1条棍子,或者是除去两根最长的其他都能放下,所以求两者最小值即可。

#include <cstdio>
#include <algorithm>
using namespace std ;
const int N = 1e5 + 5 ;
int a[N] ; 
int main(){
	int n , t ; 
	scanf ("%d",&t) ;
	while(t --){
		scanf("%d",&n) ; 
		for(int i = 1 ; i <= n ; ++ i)
			scanf ("%d",&a[i]) ;
		sort(a+1,a+1+n) ; 
		printf ("%d\n",min(a[n-1]-1,n-2)) ;
	}	
	return 0 ; 
}
B - Pillars

题意:有n个柱子,每个柱子上有半径为r的光碟,每次移动的光碟所在的柱子只能有一张光碟,且只能小的光碟移动到大的光碟上,并且只能在相邻的柱子上移动。
题解:光碟半径为n的左边递增,右边递减。

#include <cstdio>
#include <algorithm>
using namespace std ;
const int N = 2e5 + 5 ;
int a[N] ; 
int n ; 
bool check(){
	for (int i = 2 ; i <= n ; ++ i){
		if (a[i] > a[i-1])	continue ; 
		else{
			for (int j = i+1 ; j <= n ; ++ j){
				if (a[j] < a[j-1])	continue ; 
				else{
					return false ; 
				}	
			}
			return true ;
		}
	}
	return true ; 
}
int main(){
	scanf("%d",&n) ; 
	for(int i = 1 ; i <= n ; ++ i)
		scanf ("%d",&a[i]) ;
	if (check())	printf ("YES\n") ;
	else	printf ("NO\n") ;
	return 0 ; 
}
C - Array Splitting

题意:给出长度为n的数列和数字k,要求把n分为k份,每一份数列的值为其中的最大值减去最小值,求分割完之后的总价值最小为多少。
题解:求数列的前一个数和后一个数的差,将新的数列排序,删去最后k-1个即可(即求前n-k+1个的和)。

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std ;
const int N = 3e5 + 5 ;
int a[N] , b[N] ; 
int n ;  
int main(){
	int n , k ; 
	scanf("%d%d",&n,&k) ; 
	scanf ("%d",&a[1]) ;
	for(int i = 2 ; i <= n ; ++ i){
		scanf ("%d",&a[i]) ;
		b[i] = a[i] - a[i-1] ; 
	}
	sort(b+2,b+n+1) ;
	long long ans = 0 ; 
	for (int i = 2 ; i <= n-k+1 ; ++ i){
		ans += b[i] ;
	}
	cout << ans << endl ;
	return 0 ; 
}
D. Yet Another Subarray Problem

题意:给出长度为n的数列和m、k,求下图公式的最大值
在这里插入图片描述
题解:
每个m个数就要减去一个k,枚举最右边的数然后比较(emmmmmm说实话我还是有点似懂非懂,再好好想想)。


#include <cstdio>
#include <algorithm>
using namespace std ; 
const int N = 3e5 + 5 ; 
typedef long long ll ; 
ll num[N] ;  
int main(){
	int n , m , k ; 
	scanf ("%d%d%d",&n,&m,&k) ;
	for (int i = 1 ; i <= n ; ++ i)
		scanf ("%lld",&num[i]) ;
	ll ans = 0 ; 
	for (int j = 0 ; j < m ; ++ j){
		ll now = 0 ; 
		for (int i = 1 ; i <= n ; ++ i){
			now += num[i] ; 
			if (i%m == j){	//选择的数字已满一组 
				now -= k ; 
				ans = max(ans,now) ;
			}
			if (now < 0)	now = 0 ;  
		}
	} 
	printf ("%lld\n",ans) ;
	return 0 ;
}
内容概要:本文《2025年全球AI Coding市场洞察研究报告》由亿欧智库发布,深入分析了AI编程工具的市场现状和发展趋势。报告指出,AI编程工具在2024年进入爆发式增长阶段,成为软件开发领域的重要趋势。AI编程工具不仅简化了代码生成、调试到项目构建等环节,还推动编程方式从人工编码向“人机协同”模式转变。报告详细评估了主流AI编程工具的表现,探讨了其商业模式、市场潜力及未来发展方向。特别提到AI Agent技术的发展,使得AI编程工具从辅助型向自主型跃迁,提升了任务执行的智能化和全面性。报告还分析了AI编程工具在不同行业和用户群体中的应用,强调了其在提高开发效率、减少重复工作和错误修复方面的显著效果。最后,报告预测2025年AI编程工具将在精准化和垂直化上进一步深化,推动软件开发行业进入“人机共融”的新阶段。 适合人群:具备一定编程基础,尤其是对AI编程工具有兴趣的研发人员、企业开发团队及非技术人员。 使用场景及目标:①了解AI编程工具的市场现状和发展趋势;②评估主流AI编程工具的性能和应用场景;③探索AI编程工具在不同行业中的具体应用,如互联网、金融、游戏等;④掌握AI编程工具的商业模式和盈利空间,为企业决策提供参考。 其他说明:报告基于亿欧智库的专业研究和市场调研,提供了详尽的数据支持和前瞻性洞察。报告不仅适用于技术从业者,也适合企业管理者和政策制定者,帮助他们在技术和商业决策中更好地理解AI编程工具的价值和潜力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值