虚心的存钱罐
虚心的存钱罐
全部文章
分类
题解(58)
归档
标签
去牛客网
登录
/
注册
虚心的存钱罐的博客
全部文章
(共58篇)
题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#C++,思维跟不上
#include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n) { float s,h5; s=2*n*(1-pow(0.5,...
2021-09-14
0
344
题解 | #找出字符串中第一个只出现一次的字符#C++解法,利用string的find和rfind函数,问题就非常简单
#include<bits/stdc++.h> using namespace std; int main() { string str; while(cin>>str) { int i; for(i=0;i<st...
2021-09-13
0
327
题解 | #数组分组#搬运工,留个记录,递归解法,看答案都看得懵逼
#include<iostream> #include<vector> #include<math.h> using namespace std; vector<int> elsevec; int n,m,sum3,sum5,dis0; bool f...
2021-09-13
0
466
题解 | #数组分组#搬运工,留个记录,不是递归,我能看懂的解法
#include<bits/stdc++.h> using namespace std; int main(){ int m; while(cin>>m){ int sum3,sum5; sum3=sum5=0; ...
2021-09-13
0
508
题解 | #单词倒排#C++解法,比较简单吧,不解释了,自己看代码吧
#include<bits/stdc++.h> using namespace std; int main() { string str; while(getline(cin,str)) { vector<string> v; ...
2021-09-12
0
589
题解 | #密码验证合格程序#C++解法,代码比较简洁了,要求3通过依次截取3个字符查找是否有重复
//思路: //要求3可以依次截取3个字符,然后从后往前查找截取的子串 //如果找到的位置不等于开始截取的位置,则说明有重复子串 #include<bits/stdc++.h> using namespace std; int main() { string str; w...
2021-09-11
0
401
题解 | #输入n个整数,输出其中最小的k个#C++简洁代码
#include<bits/stdc++.h> using namespace std; int main() { int n,k; while(cin>>n>>k) { int tmp; vector<...
2021-09-11
0
432
题解 | #称砝码#C++,一楼太牛逼了
/*一楼牛逼,记录一下 怎么去重,用set集合。 首先根据输入顺序,将砝码用数字序列表示,例如2个1g和1个2g,就用 1 1 2的序列表示; set序列用来表示加入当前砝码之前能产生的重量种类; set初始化为{0};当第一个1g砝码放入时,则set中需要插入原先set中的所有元素+1g后的结果;...
2021-09-10
0
432
题解 | #在字符串中找出连续最长的数字串#C++解法,用一个容器存最长子串,如果还有更长的,则清空容器存更长的子串
//整体思路:用一个容器存最长子串,如果还有更长的,则清空容器存更长的子串 #include<bits/stdc++.h> using namespace std; int main() { string str; while(cin>>str) { ...
2021-09-09
0
484
题解 | #记负均正II#C++解法,根据题目意思来就行了
#include<bits/stdc++.h> using namespace std; int main() { int tmp; vector<int> v; while(cin>>tmp) { v.push_b...
2021-09-08
0
401
首页
上一页
1
2
3
4
5
6
下一页
末页