博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[LIS]外星人的密码数字
阅读量:4695 次
发布时间:2019-06-09

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

思考

首先题目已经提示的很明显了,最长不降子序列。但是把字符串转换成数组就需要一定的技巧。在这里我用的map<char,int> 每个字符串映射一个数字

#include 
#include
#include
#include
#include
#include
using namespace std;map
s;char fuck,t[1005];int a[1005],dp[2333];int main(){ for(int i=1;i<=26;i++){ char fuck; fuck = getchar(); //单个字符串读入 s[fuck]=i; //每个字符串映射 第i个数字 } while( ~scanf("%s",&t[1]) ){ //从1位置开始读入 int tot = strlen(&t[1]); for(int i=1;i<=tot;i++){ a[i] = s[t[i]]; //转化为数组 } int ans=0; //O(N^2)的LIS for(int i=1;i<=tot;i++){ dp[i]=1; for(int j=1;j
代码实现

 

 

吐槽

tvvj的评测姬终于不搞事情了,之前每次提交不是 Runing 就是 System error....

转载于:https://www.cnblogs.com/OIerLYF/p/6950689.html

你可能感兴趣的文章
leetcode[33]Search in Rotated Sorted Array
查看>>
安卓上按钮绑定监听事件的两种写法
查看>>
OpenCV Shi-Tomasi角点检测子
查看>>
jQurey基础简介
查看>>
GCC 提供的原子操作
查看>>
zTree树形插件使用 异步加载方法,Struts2框架
查看>>
使用TreeView+ListBox+TxtBox 资料管理器
查看>>
android 之 Service(Context BindService())
查看>>
python自动化七--操作mongodb,模块导入,接口开发,读取excel,修改excel
查看>>
iOS 开发笔记-UILable/UIFont/UIButton常见设置
查看>>
操作系统进程间通信简述
查看>>
2016-2017 National Taiwan University World Final Team Selection Contest
查看>>
2018 Wannafly summer camp Day3--Shopping
查看>>
(转)wireshark过滤语法总结
查看>>
阿里云大数据三次技术突围:Greenplum、Hadoop和“飞天”
查看>>
项目一~达人美食图册详情
查看>>
Border Collapse differences in FF and Webkit
查看>>
shell 中数组学习
查看>>
解决scrollView中嵌套编辑框导致不能上下滑动的问题
查看>>
<mvc:annotation-driven/>与<context:annotation-config/>的区别
查看>>