博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
蓝桥杯 算法提高 现代诗如蚯蚓
阅读量:4139 次
发布时间:2019-05-25

本文共 671 字,大约阅读时间需要 2 分钟。

  算法提高 现代诗如蚯蚓  
时间限制:1.0s   内存限制:256.0MB
    
问题描述
  现代诗如蚯蚓

  断成好几截都不会死

  字符串断成好几截

  有可能完全一样

  请编写程序

  输入字符串

  输出该字符串最多能断成多少截完全一样的子串
输入格式
  一行,一个字符串
输出格式
  一行,一个正整数表示该字符串最多能断成的截数
样例输入
abcabcabcabc
样例输出
4
样例说明
  最多能断成四个”abc”,也就是abc重复四遍便是原串

  同时也能断成两个”abcabc”

  最坏情况是断成一个原串”abcabcabcabc”
数据规模和约定
  字符串长度<=1000
#include 
#include
#include
#include
#include
using namespace std;int main(){ string s; int i,j,len,length; bool flag,ok; while(cin>>s){ length=s.length(); ok=0; for(len=1;len<=length;len++){ //长度 if(length%len!=0) //不可平分 continue; for(i=0;i

转载地址:http://nbmvi.baihongyu.com/

你可能感兴趣的文章
apache和tomcat整合
查看>>
java虚拟机错误问题
查看>>
oracle建立表空间
查看>>
oracle分区表的性能提升
查看>>
"Cannot allocate memory" OutofMemory when call Ant to build Polish project in Tomcat
查看>>
dumpcap抓包(python)
查看>>
查看文件是否被其他进程访问
查看>>
字符编码详解
查看>>
python使用dpkt分析wireshak报文(Modbus规约)
查看>>
css中的IFC
查看>>
CentOS 6.5下 mysql用户root登录不了
查看>>
windows + tomcat 部署web服务 http 改为https访问方法
查看>>
Windows系统下Apache 服务器启动以及过程中产生问题的解决办法
查看>>
Oracle服务说明
查看>>
异常收集(三):Missing artifact com.oracle:ojdbc6:jar:1.0 两种解决方案
查看>>
异常收集(四):Plugin execution not covered by lifecycle configuration
查看>>
异常收集(五):Io 异常: The Network Adapter could not establish the connection
查看>>
JSP中的转义字符
查看>>
SQLException: The user specified as a definer ('root'@'%') does not exist
查看>>
Linux 操作指令收集
查看>>