东华复试OJ二刷复盘15

进阶22:输出该字符串最多能断成多少截完全一样的子串,样例输入abcabcabcabc样例输出4,最多能断成四个"abc",也就是abc重复四遍便是原串,同时也能断成两个"abcabc",最坏情况是断成一个原串"abcabcabcabc"。

  • 思路:最大的截断数是按1分割,所以输出最大截断数量只需要从1递增,第一个符合截断串完全一致的即为答案。最大值为字符串的一半和字符串长度本身。
  • 代码错误:1.字符串的遍历步长为i+=cur而非i++,2. 用cur=3作为初值来测试题目,提交时没有改。
cpp 复制代码
#include <bits/stdc++.h>
using namespace std;

bool Check2(int index1,int index2,string &s1){
	int len = index2 - index1;
	for(int i=0;i<len;i++){
		if(s1[index1] != s1[index2])return false;
		index1++;index2++;
	}
	return true;
}

bool Check(int &cur,string &s1){
	for(int i=0;i<s1.size()-cur;i+=cur){
		if(Check2(i,i+cur,s1) == false)return false;
	}
	return true;
}

int main(){
	string s1;
	cin>>s1;
	int cur=1;
	int ans=0;
	while(cur<s1.size()/2){
		if(Check(cur,s1)){
			ans=cur;
			break;
		}
		cur++;
	}
	//cout<<ans<<endl;
	if(ans)cout<<s1.size()/ans<<endl;
	else{
		cur=s1.size()/2;
		if(Check(cur,s1))cout<<s1.size()/cur<<endl;
		else cout<<s1.size()/s1.size()<<endl;
	}
	system("pause");
} 
//abcabcabcabc

Generative artificial intelligence refers to a class of AI technologies that can generate new content such as text, images, and audio. Unlike traditional discriminative models, generative models learn the distribution of data and produce new samples based on learned patterns. In recent years, with the advancement of deep learning techniques, generative models have achieved significant progress in many fields. For instance, generative adversarial networks and large language models are capable of producing high-quality images and natural language text. These technologies have broad application prospects in areas such as content creation, intelligent assistants, and virtual reality. However, generative AI also introduces challenges such as the spread of misinformation and copyright protection issues. Therefore, how to strengthen regulation while promoting technological development has become an important research topic.

  • 生成式人工智能是指人工智能的一个能生成诸如文本图片或音频的新内容的类别。不同于传统的判别式模型,生成式模型学习数据的分配并生成基于已学习模式的新样本。在近年来,伴随着深度学习技术的发展,生成式模型已在许多领域取得了显著的进步。例如,生成式对抗网络和大语言模型它们能生成高质量的文本和自然语言文本。这些技术有广阔的应用前景在例如内容生成、智能助理和虚拟现实这些领域。然而,生成式人工智能也引发了例如错误信息的扩散和版权保护问题。从而,如何在推动技术发展的同时强化监管已经成为了一个重要的研究话题。
  • refers to 指的是/参考/引用、discriminative 判别式、adversarial 对抗的
相关推荐
前进的李工5 小时前
Agent 学习笔记 05:系统提示词应该怎么写
笔记·学习·prompt·agent·个人开发·few-shot·ai应用开发
正在走向自律7 小时前
【3/5】人工智能训练师 三级/高级工 考证学习方向:从“独立执行”到“设计、归因与全链条负责”
人工智能·学习·人工智能训练师·注方案设计·数据质控负责人·模型评测与调优辅助·ai训练项目交付
CCIE-Yasuo8 小时前
网络安全-学习数据库-Mysql-2
数据库·学习·mysql
La Pulga9 小时前
【FreeRTOS源码学习笔记】任务切换
单片机·mcu·学习·嵌入式·freertos·实时操作系统
li星野10 小时前
【学习记录】逻辑分析仪完全入门:从品牌方案到采样率、存储深度的核心概念解析
学习
旖旎夜光10 小时前
【C++ 基础入门】类和对象(上):封装、对象模型与 this 指针
开发语言·c++·笔记·学习
WEI_YANG_JU11 小时前
初中数学教学中合作学习的研究与实践
学习
码农小韩11 小时前
FPGA学习(一)——LED点灯与开发流程
学习·fpga开发·入门·环境配置·仿真·点灯
李长渊哦12 小时前
Qoder 自定义子智能体(Subagent)学习笔记
chrome·笔记·学习
代码山河12 小时前
基本类型转换:自动类型转换与强制类型转换
java·学习·架构·教程·面向对象·项目