- 博客(6)
- 收藏
- 关注
原创 字符串
文章目录一、字符串的形式二、字符串的输入输出三、字符串函数四、字符串的增、删、改、查。# 一、字符串的形式1." ";双引号之间的字符串(结尾自动添加’\0’)。代码如下(示例):string s="hello world";//定义cout<<s;//输出2.以’\0’结尾的字符串数组。代码如下(示例):int n=11;char s[n]={"hello world"};//定义//输出方式1:可以按照字符串的方式输出cout<<s<&
2020-10-04 11:15:45 227
原创 Zut_round 9(搜索)
题目链接:https://vjudge.net/contest/370404#problemD - The Fair Nut and Elevator题意:一个n层的房子,第i层楼的人数ai(i=1,2,,,,n),每个人每天早晚各使用一次,且电梯每次只能乘坐一人。1、早上:电梯从x层到a层,然后到1层,再回到x层。2、晚上:从x层到1层,将人送到a层,再回到x层。问电梯共走了多少层。...
2020-05-06 17:18:16 111
原创 Zut_round 8(多维dp1)
题目链接:(https://vjudge.net/contest/369743#problem)A - 编辑距离 裸题#include <iostream>#include<algorithm>#include<math.h>#include<cstring>using namespace std;int dp[1005][1005];...
2020-04-28 14:41:33 156
原创 Zut_round 7(二分答案)
题目链接:(https://vjudge.net/contest/368387#problem)**二分答案其实就是在已知条件下又增加了一个条件**二分答案的基本思路,对所求数值的所在范围进行二分查找,对特定数值进行判断是否符合要求。但是难点在于f(x)函数,要根据题目来写。A - 二分(经典题)(*)(最大化最小值)fun函数内贪心判断,设两个指针,找到最近的前面的不小于后面的位置...
2020-04-24 08:28:50 110
原创 Zut_round 6(动态规划)
题目链接:(https://vjudge.net/contest/366955#problem)A -LIS O(n^2) 模板(最长上升子序列)思路 :找出i前面的最大长度,使得dp[i]的能取到当前长度的最大值#include <iostream>using namespace std;int main(){ int n,h[1005],dp[1005],m...
2020-04-13 21:22:45 182
原创 Alice and the List of Presents(寒假练习)
Alice got many presents these days. So she decided to pack them into boxes and send them to her friends.There are n kinds of presents. Presents of one kind are identical (i.e. there is no way to dist...
2020-02-07 15:36:53 235 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人