AmaZhao
AmaZhao
全部文章
分类
芝士(2)
题解(29)
归档
标签
去牛客网
登录
/
注册
AmaZhao的博客
全部文章
(共29篇)
题解 | #反向输出一个四位数#
本做法将四位扩至无数位 #include <iostream> #include <string> using namespace std; int main(){ string a; ...
C++
2025-09-18
1
24
题解 | #hello world#
在这段代码中,hello world 字符串中的每个字符(包括空格)都会被处理。具体来说,代码中的 for 循环遍历字符串 word 的每个字符,并将每个字符的 ASCII 值加 1 后输出。 详细分析: 字符串 word 的内容: word = "hello world",包含 11 个字符...
C++
2025-09-18
0
44
题解 | #组队比赛#
解一: 先运用sort函数对四个参数进行大小的升序排序 再然后将最小最大 次小次大进行相加 最后运用abs函数求出最大值 #include <iostream> #include <algorithm> #include <vector> using na...
C++
2025-09-16
0
34
题解 | #纸牌#
会的!在OJ中输出浮点类型还是整数类型的整数可能会严重影响AC结果! 为什么会影响AC结果 精度问题 // 整数输出(精确) cout << 5; // 输出: "5" // 浮点数输出(可能带小数或科学计数...
C++
2025-09-16
0
38
题解 | #使徒袭来#
1111如何进行开三次方的运算? 引入cmath库 然后进行pow函数的运用 double average = pow(a , 1.0/3.0); 这样就是相当于开了三次方根 2如何进行限定小数点??引入iomanip库 运用 setprecision函...
C++
2025-09-15
0
33
题解 | #疫情死亡率#
1 输入一个值之前 需要先行对其进行声明形式 “int c = d = 0”的写法是大错特错 因为其没有对d进行声明 2在想要限定输出几位小数时,可以使用 头文件中的 setprecision() 和 fixed 来指定输出小数位数。 #include #include using namesp...
C++
2025-09-15
0
33
题解 | #乘法表#
重点:转义符的使用 \加在双引号、\n的前面可以使这些符号失去功能不被读取。 #include using namespace std; int main(){ cout << "printf("Hello world!\n");" <<endl << "cou...
C++
2025-09-11
0
37
题解 | #乘法表#
这题是我第一次接触cpp的条件判断 对于观察得出第一列 第二列的前三个 第三列的第一个的等号后都有空格 目标就转变为如何将上述条件转为条件判断 #include using namespace std; int main(){ for (int i = 1; i <= 9; i++){ fo...
C++
2025-09-11
0
34
题解 | #小飞机#
1 在c++中 回车无法被print出来 想要print必须使用endl #include using namespace std; int main() { cout << " ** "<< endl << " ** "<...
C++
2025-09-11
0
41
首页
上一页
1
2
3
下一页
末页