福涂
福涂
全部文章
分类
归档
标签
去牛客网
登录
/
注册
福涂的博客
TA的专栏
60篇文章
0人订阅
计算机复试机试(王道版)
59篇文章
408人学习
浙大版《C语言程序设计第4版》
1篇文章
170人学习
全部文章
(共45篇)
题解 | 括号配对问题
来自专栏
有两个需要注意的点:1.(sta.empty()||sta.top() != '[' )这个判断是从左到右的短路判断,应该先判空,不空再判断是否匹配,否则sta.top()可能导致程序异常2.循环结束后,栈为空才匹配完成 #include<stdio.h> #include<sta...
2026-01-31
0
59
题解 | 编排字符串
来自专栏
思路:每输入一行字符串进栈st,把st复制一份到stShow,stShow循环4次输出栈顶元素后出栈,若空栈立即退出循环。 #include<stdio.h> #include<stack> #include<string> using namespace std...
2026-01-31
0
51
题解 | 浮点数加法
来自专栏
思路:1.分别对其小数部分和整数部分,因为补0位置不同,所以分别对齐(注意对齐整数部分时小数点位置会变化)2.小数部分加法和整数部分加法一样,用一个函数实现(注意跳过小数点)3.最后检查结果进位ps:如果题目还要求去掉小数点后的无效0://如果末尾是0或.,删除 while (str1...
2026-01-29
0
65
题解 | skew数
//简单题不过要小心,字符串的下标是从左到右的,第K位是从右到左数的 #include<stdio.h> #include<string> #include<iostream> #include<cmath> using namespace std...
2026-01-29
0
58
题解 | 单词替换
//直接使用find()的话不是单词也可能匹配到 //手动给a,b加空格 //因为a可能在开头和结尾也匹配到,也给原字符串前后加上空格 //最后截掉头尾输出子串 #include<stdio.h> #include<string> #include <iostream&...
2026-01-28
0
56
题解 | 日期类
来自专栏
#include<stdio.h> using namespace std; void nextday(int& year, int& month, int& day) { int dayofmonth[] = { 0, 31, 28, 31, 30, ...
2026-01-27
0
47
题解 | Day of Week
来自专栏
#include<stdio.h> #include<string.h> using namespace std; //首先要算出距离1年1月1日已经过了几天,再模7得到是星期几 //计算下一天的日期函数 void nextday(int& year, int&am...
2026-01-27
0
69
题解 | 日期累加
来自专栏
#include<stdio.h> using namespace std; void nextday(int& year, int& month, int& day) { int dayofmonth[] = { 0,31,28,31,30,31,30,31...
2026-01-27
0
50
题解 | 日期差值
来自专栏
#include<stdio.h> using namespace std; void nextday(int& year, int& month, int& day) { int dayofmonth[] = { 0, 31, 28, 31, 30, ...
2026-01-27
0
43
题解 | 打印日期
来自专栏
#include<stdio.h> using namespace std; void nextday(int& year, int& month, int& day) { int dayofmonth[] = {0,31,28,31,30,31,30,31,...
2026-01-27
0
49
首页
上一页
1
2
3
4
5
下一页
末页