上一页 1 ··· 6 7 8 9 10 11 12 13 下一页
摘要: 1019 数字黑洞 (20分) 一个字符串的写法,坑点就是可能会出现不到4位的数,进行补零 #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> #incl 阅读全文
posted @ 2020-06-15 13:36 chstor 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 1035 插入与归并 (25分) 数据比较小,归并不用写合并函数,直接sort 中间序列不包括初始序列 #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> 阅读全文
posted @ 2020-06-15 08:14 chstor 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 1045 快速排序 (25分) 求划分的主元(比左边的都大,右边的都小) #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> #include<strin 阅读全文
posted @ 2020-06-14 08:53 chstor 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 1040 有几个PAT (25分) 和1045快排那个思想很像 左边、右边的分别累加在数组中存入 #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> #i 阅读全文
posted @ 2020-06-14 08:51 chstor 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1030 完美数列 (25分) 二分查找常用函数: lower_bound() 函数用于在指定区域内查找不小于目标值的第一个元素 upper_bound() 函数定义在头文件中,用于在指定范围内查找大于目标值的第一个元素 第一次写的代码,测试点4没过 下面举个例子,如数组:1,2,3,4,5,6,7 阅读全文
posted @ 2020-06-13 08:49 chstor 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 1020 月饼 (25分) 把单价先计算一下,然后按照单价高依次出售 #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> #include<string> 阅读全文
posted @ 2020-06-12 09:40 chstor 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1023 组个最小数 (20分) -做完散列感觉这个好像散列,算法笔记把它分在了贪心emmm #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> #inc 阅读全文
posted @ 2020-06-12 09:39 chstor 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1005 继续(3n+1)猜想 (25分) 输入的数列里面,输出“关键数”(没被覆盖的) 标记一下n往后的就可以了,标记的是覆盖的 eg:{3、5、8、4、2、1},标记{5、8、4、2} #include<iostream> #include<vector> #include<cctype> #i 阅读全文
posted @ 2020-06-11 19:34 chstor 阅读(97) 评论(0) 推荐(0) 编辑
摘要: #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> #include<string> #include<cstdio> #include<algorith 阅读全文
posted @ 2020-06-11 19:31 chstor 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1043 输出PATest (20分) 注意控制已有字符的输出 存放的输出了就减一,存放个数必须大于零 #include<iostream> #include<vector> #include<cctype> #include<map> #include<set> #include<sstream> 阅读全文
posted @ 2020-06-11 19:29 chstor 阅读(190) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 下一页