牛客题解官
牛客题解官
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客题解官的博客
全部文章
/ 题解
(共587篇)
网购
分析: 本题逻辑相对比较复杂,首先是数据的读入和判断是否有优惠券接下来是日期匹配,即检查是否是双十一或者是双十二最后是打折,以及优惠券的使用(使用了双目运算符),题目中也提醒了最终结果不能为负数也就是说打完折后需要判断使用优惠券是否会出现价格为负数的情况出现。 题解: #include <bi...
2020-06-04
0
724
竞选社长
分析: 按照题意读入多个数据,如果当前字符为0则退出循环,最后对比A,B两者的票数输出结果即可。 题解: #include <bits/stdc++.h> using namespace std; int main() { int a_count = 0, b_count = ...
2020-06-04
1
733
判断整数奇偶性
分析: 首先处理多行读入,判断奇偶性可以通过位运算或者求余运算判断。 题解1: 位运算解法 #include <bits/stdc++.h> using namespace std; int main() { int val = 0; //循环读入数据 whil...
2020-06-04
1
771
最高分数
分析: 由于每个学生都有三门成绩,故每三个数中选取最大的数,通过对计数值对3求余判断即可,然后重置最大值即可。另一种解法可以用三个变量保存,然后对三个数进行比较选取最大值即可。 题解: #include <bits/stdc++.h> using namespace std; int ...
2020-06-04
1
718
判断是元音还是辅音
分析: 处理完多行输入后,注意判断是否为换行符,可以先将字符统一转换成大写或者小写之后再判断。 题解: #include <bits/stdc++.h> using namespace std; int main() { char ch = 0; //循环读入字符 ...
2020-06-04
11
1316
及格分数
分析: 逻辑简单,读入多行数据后挨个判断该分值是否满足60分即可。 题解: #include <bits/stdc++.h> using namespace std; int main() { int score = 0; //循环读入成绩 while(sca...
2020-06-04
0
607
完美成绩
分析: 读入多行数据之后进行区间判断即可,对于这类判断表达式要注意& | !三种逻辑运算符的使用。 题解: #include <bits/stdc++.h> using namespace std; int main() { int val = 0; //循环读...
2020-06-04
1
794
计算单位阶跃函数
分析: 本题考察多组数据输入和使用if语句进行区间判断,同时注意if else嵌套方法防止判断失败。 题解: #include <bits/stdc++.h> using namespace std; int main() { int t = 0; //循环输入t ...
2020-06-04
1
1158
获得月份天数
分析: 月份天数可以使用闰年平年判断然后打表输出,也可以使用口诀一三五七八十腊再输出。 题解: #include <bits/stdc++.h> using namespace std; int main() { int year = 0, month = 0; //设...
2020-06-04
0
848
简单计算器
分析: 本题逻辑相比之前题型而言较为复杂,表达式输入完毕之后首先对运算符进行合法判断,接下来分别对加减乘除进行单独处理,此时可选if else嵌套或者switch进行处理,最后输出结果即可。 题解: #include <bits/stdc++.h> using namespace std...
2020-06-04
1
777
首页
上一页
40
41
42
43
44
45
46
47
48
49
下一页
末页