东华复试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 对抗的
相关推荐
Byron__12 小时前
AI学习_06_短期记忆与长期记忆
人工智能·python·学习
试剂界的爱马仕13 小时前
Anti-mouse PD-1 mAb (Clone RMP1-14) 与 Axitinib 小鼠实验使用方案整理汇总
大数据·人工智能·深度学习·学习
Gp7HH6hrE14 小时前
OpenAI 与 Anthropic 开放公共学习平台
人工智能·学习·chatgpt
kaixin_learn_qt_ing15 小时前
2026.7.3---学习记录
学习
99乘法口诀万物皆可变16 小时前
PcanToVectorXL_V01:打通 Vector 与 PCAN 的双向 CAN/CAN‑FD 桥梁
c++·学习
MartinYeung516 小时前
[论文学习] CAMIA:下文感知成员推理攻击
人工智能·深度学习·学习
secondyoung16 小时前
Cortex-R52学习:存储系统
arm开发·单片机·学习·arm
科技IT杂谈16 小时前
2026年智能体与定制工具平台观察:五个平台的路径与场景
学习
New农民工16 小时前
射频芯片学习-Lora包参配置
学习
Turbo正则17 小时前
群论学习入门 | 群论与李群的基本概念
人工智能·学习·算法·抽象代数