摘要: 考试过程中,遇到过这种情况,直接蒙了。 这是别人的代码 1 #include <iostream> 2 #include <sstream> 3 #include <string> 4 #include <vector> 5 #include <algorithm> 6 7 using namesp 阅读全文
posted @ 2022-02-14 22:44 技术笔记记录 阅读(769) 评论(0) 推荐(0)
摘要: 分析:我的想法是用cin加循环来屏蔽掉输入过程中的空格,于是写出了以下代码: 1 #include "iostream" 2 #include <vector> 3 #include "algorithm" 4 using namespace std; 5 int main() 6 { 7 8 st 阅读全文
posted @ 2022-02-14 22:28 技术笔记记录 阅读(95) 评论(0) 推荐(0)
摘要: 题目描述如下: 分析:之前做过这样的一道题,但是写得太繁琐,今天重新做了这道题。很明显的感觉做出来的效率提升了很多。 这道题的一个难点是,怎么样处理字符串长度大于8,截断后又大于8,又需要截断的情况。很显然,这种场景的处理逻辑应该要用到while循环。完整的代码如下: 1 #include <ios 阅读全文
posted @ 2022-02-14 21:25 技术笔记记录 阅读(139) 评论(0) 推荐(0)