hihoCoder_W84 Lucky Substrings(基础做法)

Liquibase 4.31.0 Windows 实操指南:类加载、UTF-8 编码与 JDK 兼容性校准 数据库迁移工具 Liquibase 的核心价值在于提供可重复、可验证、跨环境一致的结构变更能力。其底层依赖 JVM 类加载机制、字符编码解析与 JDBC 驱动绑定,而这些在 Windows 平台因默认 GBK 编码、路径分隔符、JDK 模块演进(如 JAXB 移除)等因素易产生隐性不一致。Liquibase 4.31.0 作为兼容 JDK 11/17/21 且仍完整支持 Windows 命令行脚本(liquibase.bat)的稳定版本,需重点校准 file.encoding=UTF-8 强制设置、clas 阅读详情

【题目】

点击这里

【思路】

分两步走,1. 找出所有斐波那契子串;2. 按字典序无重复地输出。

第一步可以枚举子串,由于规模比较小,O(n^2)的算法都可以接受。O(n^3)优化至O(n^2)的方法是,从前往后枚举子串,[i…j+1]可以利用[i…j]的结果。

第二步可以选择排序,然后无重复输出,也可以考虑建立字典树去重并排序,然后先序遍历输出。字典树的方法将在下周贴上来。

【代码】

#include <stdio.h>
#include <string.h>

char a[6000][101];
int ans=-1;

void push(char s[], int p, int q)
{
    int i; ans++;
    for (i=p;i<=q;i++) a[ans][i-p]=s[i];
    a[ans][q-p+1]='\0';
}

int comp(const void *a, const void *b){return strcmp((char *)a,(char *)b);}

int main()
{
    char s[110];
    scanf("%s",s);
    int verif[26]={0}; verif[1]=1; verif[2]=1; verif[3]=1; verif[5]=1; verif[8]=1; verif[13]=1; verif[21]=1;
    int i,j,sLen=strlen(s);
    for (i=0;i<sLen;i++)
    {
        int total=0; int check[26]={0};
        for (j=i;j<sLen;j++)
        {
            if (check[s[j]-'a']==0){total++; check[s[j]-'a']=1;}
            if (verif[total]==1) push(s,i,j);
        }
    }
    qsort(a,ans+1,sizeof(a[0]),comp);
    printf("%s\n",a[0]);
    for (i=1;i<=ans;i++) if (strcmp(a[i],a[i-1])!=0) printf("%s\n",a[i]);
    return 0;
}

基于PSINS的INS/NHC/ODO组合导航仿真全解析 组合导航通过多传感器融合克服单一导航系统的局限,是车辆自主定位的关键技术。其中惯性导航(INS)依靠陀螺仪与加速度计积分推算运动状态,但误差随时间累积;GNSS提供绝对位置,却在城市峡谷中易受多径效应和遮挡影响导致定位漂移。卡尔曼滤波作为信息融合核心,将不同量测按统计特性加权,实现优势互补。基于PSINS开源工具箱搭建的SINS/GNSS/ODO/NHC组合导航仿真,能够在GNSS失锁条件下利用非完整约束和里程计抑制惯性误差发散,广泛应用于无人驾驶、物流车辆自主定位等场景。本文围绕PSINS仿真环境,详细拆 阅读详情

相关推荐

野火STM32F407(骄阳)+无刷直流驱动板+永磁同步电机控制学习记录(四)(基于HAL库)

以上内容都是参考别人资料自学的,很多地方都是凭感觉,因为理论部分不太会算,只要电机能转就行,其他性能指标都没考虑,因为不会,所以这纯属是学习记录帖。带宽在500时,电流波动小,但是响应很慢,就是堵转后不太容易恢复转动。速度环带宽设定小了,响应不够快,带宽设定大了波动比较大,电机感觉起来也震一点,而且,当带宽设到200的时候,启动直接就锁死了,应该是PI增益设定太大了。电流环带宽的试验:去掉速度环,让Iq_Set=2,Ud=0,此时电机是电流环闭环控制,用手堵转电机然后松开,看电流的波动以及响应情况。

XUEXIDEXIAOhai的博客 4571

Lucky Substrings HihoCoder - 1152 字符串

题目A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters, output all its lucky non-empty substrings in le

xinxiaxindong的博客 362

使用STM32微控制器实现光电传感器的接口和数据处理

本文将介绍如何使用STM32微控制器实现光电传感器的接口和数据处理的方案,包括硬件设计、引脚配置、数据采集、滤波和阈值判断等关键步骤,并给出相应的代码示例。本文将介绍如何使用STM32微控制器实现光电传感器的接口和数据处理的方案,包括硬件设计、引脚配置、数据采集、滤波和阈值判断等关键步骤,并给出相应的代码示例。在光电传感器的接口和数据处理的实现过程中,要关注系统的性能。在使用STM32微控制器实现光电传感器的接口和数据处理之前,需要设计一个合适的硬件平台。

weixin_66608063的博客 3209

Lucky Substrings微软在线测试

时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case

leo1949asd的专栏 1560

资治通鉴:文言文、白话文对照读本

介绍一处可以免费下载资治通鉴的网址,该文献共20卷,排版为左边是文言文,右边是白话文翻译,对照阅读非常方便。下面是1-20卷的链接地址:第一卷:http://www.docin.com/p-9705067.html 第二卷:http://www.docin.com/p-9705979.html 第三卷:http://www.docin.com/p-9709382.html 第四卷:

aiwis的专栏 2559

六维力传感器:原理、选型与应用全解析

在机器人、自动化与精密测量领域,力觉感知是实现智能控制与自适应操作的核心技术。其基本原理是通过传感器将物理世界的力学作用转化为可处理的电信号,从而为系统提供关键的交互信息。这项技术的核心价值在于,它使机器从简单的程序执行升级为具备环境感知与反馈能力的智能体,极大地提升了操作的精度、安全性与适应性。从技术实现上看,它依赖于精密的弹性体结构设计与高灵敏度的应变片传感,并通过复杂的信号调理与数据处理来保证测量精度。在实际工程中,六维力传感器的应用场景广泛,例如在机器人**柔顺装配**中实现微米级的精准对位,在**

weixin_29189003的博客 399

hihocoder #1152 : Lucky Substrings

描述A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters, output all its lucky non-empty substrings in le

度凡心的博客 543

嵌入式SD/TF卡通用协议-SDIO协议

为了驱动SD卡,首先的第一步就是观察SD卡引脚接线情况,通常我们在画原理图时,都是使用的SD卡卡槽与MCU进行接线。SD卡可以使用SDIO协议和SPI协议进行通信,这里我们主要介绍SDIO协议。下图中的TF卡只是容量小一点的SD卡。以F1C100S为例,接线图如下所示:我们发现上图中的TF卡使用的协议为SDIO协议,主要有4根数据线,1根命令线,1根时钟线组合而成。为了驱动这个SD/TF卡我们就需要去了解SDIO协议的时序。

qq_1033275663的博客 3059

hihoCoder week 84 P1 : Lucky Substrings 【dp】

P1 : Lucky Substrings Time Limit:10000ms Case Time Limit:1000ms Memory Limit:256MB Description A string s is LUCKY if and only if the number of different characters in s is a

世界很大 576

李宏毅2025《机器学习》第一讲-生成式AI:技术突破和未来发展

本文基于台湾大学李宏毅教授的“一堂课搞懂生成式人工智慧的技术突破与未来发展”课程内容,系统性地梳理了生成式AI的核心概念、技术原理、发展演进以及未来趋势。文章从AI的“行为”入手,通过生动的实例展示了其强大的生成与推理能力;进而深入剖析其底层运作机制,阐释了“万物皆为令牌(Token)”、自回归生成、Transformer架构等核心原理;接着,文章追溯了通用AI模型从“专才”到“通才”的演进历程;最后,探讨了如何通过微调(Fine-tuning)、模型编辑(Model Editing)等技术赋予AI新的能力

木鱼时刻的专栏 2299

RAG测评实战代码

本文主要介绍了RAG测评实战代码,希望对使用RAG的同学们有所帮助。 文章目录 1. 前言 2. 实战代码 2.1 实战代码一 2.2 实战代码二

herosunly的博客 1万+

[HIHO1152]Lucky Substrings(暴力,枚举)

题目链接:http://hihocoder.com/problemset/problem/1152 题意:给一个字符串,找所有的满足不同字符数为斐波那契数的子串。 暴力,枚举。 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 const int maxn = 111; 5 const int ma...

weixin_30377461的博客 193

AUTOSAR TcpIp模块 以太网配置开发2

someip协议之tcpIp协议

汽车电子电气 1090

hihocoder Lucky Substrings

lucky substringsA string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters, output all its lucky non-empty s...

周周的博客 248

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

hihocoder #1152 Lucky Substrings 【字符串处理问题】strsub()函数+set集合去重

#1152 : Lucky Substrings时间限制:10000ms单点时限:1000ms内存限制:256MB描述A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower cas...

weixin_30781107的博客 211

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

算法笔试题:LUCKY STRING

本题是来自微软2016年校招题 LUCKY STRING 题目描述 A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters , ou

qq_27262609的博客 660

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

hihocoder 1152 Lucky Substrings

#1152 : Lucky Substrings 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 A string s isLUCKYif and only if the number of different characters in s is afibonacci number. Given a string cons...

weixin_30245867的博客 220

Substrings POJ - 1226(水题;字符串)

题目: 提供区分大小写字母的字符串,找到最大的字符串X,以便可以将X或其逆序作为任何给定字符串的子字符串找到,输出找到的最大字符串的长度。 查找子串过程还可以用s.find(sub, 0) 返回首字符下标 核心代码: int n; string s[110]; bool ok (string r, int start, int len) { r.assign(r, start, len);...

Jungle~St... 255

The Postorder enumeration(二叉树遍历:前中转后)

【题目描述】 Give you the Preorder enumeration and Inorder enumeration of a binary tree, output its Postorder enumeration. We assume the elements of binary tree are different. 【输入要求】 The first line c

Je vole 1187

Rail station(栈)

【题目】 There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was possibl

Je vole 952

The K-th largest number(小根堆)

【题目要求】 Given N integer numbers, find the K-th largest number.  Requirement: design an algorithm with the time complexity O(NlogK). 【输入要求】 The first line contains N, K. In the following N lines,

Je vole 840

无间道之并查集_hihoCoder

描述 这天天气晴朗、阳光明媚、鸟语花香,空气中弥漫着春天的气息……额,说远了,总之,小Hi和小Ho决定趁着这朗朗春光出去玩。 但是刚刚离开居住的宾馆不久,抄近道不小心走入了一条偏僻小道的小Hi和小Ho就发现自己的前方走来了几个彪形大汉,定睛一看还都是地地道道的黑人兄弟!小Hi和小Ho这下就慌了神,捡肥皂事小,这一身百把来斤别一不小心葬身他乡可就没处说去了。 就在两人正

Je vole 763

The Maze runner(BFS)

【题目描述】 Given a maze, find a shortest path from start to exit. Input consists serveral test cases. First line of the input contains number of test case T. For each test case the first line contai

Je vole 700

Give My Text Back_hihoCoder

描述 To prepare for the English exam Little Ho collected many digital reading materials. Unfortunately the materials are messed up by a malware. It is known that the original text contains only En

Je vole 613

Binary Watch_太阁竞赛A

题目1 : Binary Watch 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Consider a binary watch with 5 binary digits to display hours (00 - 23) and 6 binary digits to display minutes (00 - 59). For example

Je vole 574

max-Queue(堆)

【题目描述】 Use a max-Heap to design a priority queue with integer value. Each element stores an integer. The larger the integer is, the higher the priority of the element is. 【题目输入】 The first line cont

Je vole 561
上一篇: poj_3450 Corporate Identity(KMP+枚举)
下一篇: poj_2506 Tiling(高精度加法)
薄帷清风
博客等级 码龄11年 31粉丝 44原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值