东华复试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 对抗的
相关推荐
星恒随风8 小时前
C++ 继承进阶:默认成员函数、多继承、虚继承与组合设计
开发语言·c++·笔记·学习
电子云与长程纠缠8 小时前
UE中使用TGuardValue与TInlineComponentArray数据结构
开发语言·数据结构·学习·ue5·游戏引擎
caimouse8 小时前
MM 学习笔记 10:页面文件与系统加载器
笔记·学习·reactos
一只小菜鸡..9 小时前
南京大学 操作系统 (JYY) 学习笔记:Hello, OS World! (程序的机器视角)
java·笔记·学习
lazy H9 小时前
从入门到日常开发,一篇文章掌握 Git 核心操作
git·后端·学习·github
a11177621 小时前
2FA 验证码生成器(github登录验证 app)
笔记·学习
我的xiaodoujiao21 小时前
API 接口自动化测试详细图文教程学习系列32--Allure测试报告2
python·学习·测试工具·pytest
你想知道什么?1 天前
线性回归-学习笔记
笔记·学习·线性回归
鱼毓屿御1 天前
从「只会聊」到「边想边做」的跃迁
前端·学习·react.js
AOwhisky1 天前
Python 学习笔记(第十五期)——运维自动化(下·后篇):堡垒机实战——paramiko高阶篇
运维·python·学习·云原生·自动化·运维开发