牛客题解官
牛客题解官
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客题解官的博客
全部文章
/ 题解
(共587篇)
计算体重系数
分析: 题目简单,读入体重和身高带入公式计算即可得出结果,控制输出结果即可。 题解: #include <bits/stdc++.h> using namespace std; int main() { int weight = 0, height = 0; scanf...
2020-06-04
0
793
总成绩和平均分计算
分析: 读入数据之后,设置输出精度输出即可,分别提供了printf和cout的精度设置方法。 题解: #include <bits/stdc++.h> using namespace std; int main() { float a = 0.f, b = 0.f, c = 0...
2020-06-04
0
713
计算三角形的周长和面积
分析: 三角形的周长计算简单,由于输入的是三边长度,这里可以使用海伦公式进行面积求解,最后控制输出格式即可。 题解: #include <bits/stdc++.h> using namespace std; int main() { int a, b, c; //读入...
2020-06-04
0
842
小飞机
分析: hello world的升级版,可以通过硬编码的方式输出,稍微改进下可以使用循环控制输出。 题解: #include <bits/stdc++.h> using namespace std; int main() { //printf硬编码输出即可 printf...
2020-06-04
11
1105
KiKi和酸奶
分析: 简单的整除和求余问题,利用所有的时间除去喝酸奶的速度得到的结果即为喝掉的酸奶,但是对于非整除情况下需要减去1,因为该瓶酸奶已经开启,故需要判断是否有余数。 题解: #include <bits/stdc++.h> using namespace std; int main() ...
2020-06-04
0
872
变种水仙花数
分析: 根据题意,对于每次拆分得到除数和余数,然后将其相乘累加即可,最后判断累加值和当前数值是否相同即可。对于拆分方法可以先设定求余数mod,然后每次对其除10,模仿拆分过程直到该值为0。 题解: #include <bits/stdc++.h> using namespace std;...
2020-06-04
15
970
衡量人体胖瘦程度
分析: 本题的坑在于未给出BMI计算公式,查阅资料之后BMI=weight/(height*height),注意单位是米和kg,对于计算出来的BMI,进行区间判断即可。 题解: #include <bits/stdc++.h> using namespace std; int main...
2020-06-04
0
802
字母大小写转换
分析: 对于每行输入的字符,首先进行大小写判断,转换方法有两种,第一种是大写-32为小写(反之亦然),另外一种方法是使用内置函数tolower和toupper进行对应的转换。 题解: #include <bits/stdc++.h> using namespace std; int m...
2020-06-04
0
774
金字塔图案
分析: 对于本题而言,首先可以明确的是n代表需要输出多少行,对于第i行而言,首先需要输出n-i个空格,接着星号和空格交替打印,题解中先计算星号和空格的个数然后循环打印更改标志位flag,最后注意最后一个*后面需要加上空格和换行。 题解: #include <bits/stdc++.h> ...
2020-06-04
0
706
翻转金字塔图案
分析: 本题与之前的打印金字塔类似由于是倒着显示,这里与之前不同的是更改了循环的初值并自减,然后记录当前行需要打印的空格space自增即可。 题解: #include &lt;bits/stdc++.h&gt; using namespace std; int ma...
2020-06-04
0
869
首页
上一页
42
43
44
45
46
47
48
49
50
51
下一页
末页