哥牛牛
哥牛牛
全部文章
分类
题解(5)
归档
标签
去牛客网
登录
/
注册
哥牛牛的博客
全部文章
(共7篇)
题解 | #名字的漂亮度#
#include <algorithm> #include <iostream> #include <vector> using namespace std; bool cmp(int a, int b) { return a > b; } int ...
2023-02-08
0
287
题解 | #求最小公倍数#
根据正常逻辑计算,按照数学上化简方式处理; #include <iostream> #include <vector> using namespace std; int main() { int a,b; cin>>a>>b; ...
2023-02-07
0
293
题解 | #键值对类型的题#
键值对类型的题,利用map键不重复的性质 首先考虑到键不会重复,其次map键具有自动排序的功能,最后可以用迭代器iterator来遍历就好了 #include <iostream> #include <map> using namespace std; int main(...
C++
2022-06-17
0
319
题解 | #取整数#
#include <iostream> using namespace std; int qz(double in) { int result=(int)(in*10); if(result%10<5) { result/=10; }...
C++
2022-06-17
0
297
题解 | #字符串8个换行输出#
字符串8个换行输出 大概分为三个部分进行输出:1.字符串长度为0的时候,直接进行输出;2.字符串为小于等于8的时候,直接输出,却位补0;3.字符串大于8的时候,以8的整数倍作为换行,最后几位补0;难点在于如何补0 和 换行; #include<iostream> #include<...
C++
2022-06-17
0
451
题解 | #字符串最后一个单词的长度#
字符串最后一个单词长度 思路: 1.将字符串进行排序; 2.将前后重复的字符串进行跳过; #include <iostream> #include <vector> using namespace std; int main(){ int number...
C++
2022-06-17
0
404
题解 | #字符串最后一个单词的长度#
统计最后一个单词的长度 1.根据空格作为分隔,即遇到空格就重新计数单词长度,并以结尾作为结束; 2.需要注意一点就是cin>>input 遇到空格会结束,因此使用getline函数作为输入; #include <iostream> #include <string>...
C++
2022-06-17
1
367