03 2022 档案
摘要:分析和思路:循环处理字符串,并更新处理后的字符串 1 // ParameterParse.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 2 // 3 4 #include <iostream> 5 6 #include "iostream" 7 #include <sst
阅读全文
摘要:1 #include <iostream> 2 3 using namespace std; 4 5 int num[9][9];//用于保存9x9盘面 6 bool flag = false;//flag为true时表示推算完成,结束递归 7 8 bool check(int n){//判断当前位
阅读全文
摘要:分析和思路:直接位运算即可 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 long long int a,b,c,d; 7 long long int num; 8 9 while(scanf("%lld.%lld
阅读全文
摘要:分析和思路:把输入的字符串反转后,求最大的公共子串,同时判断是不是回文 1 #include "iostream" 2 #include "string" 3 #include "algorithm" 4 #include "vector" 5 using namespace std; 6 7 8
阅读全文
摘要:分析和思路:其实就是找到从最左边开始以当前最右边节点结尾的最长递增子序列。注意,最长的子序列不一定包含最后一个节点。这是一个动态规划题。 1 #include "iostream" 2 #include "algorithm" 3 using namespace std; 4 5 6 //解题思路:
阅读全文
摘要:分析和思路:先插入节点,然后再打印剩余节点值即可 1 //解题思路: 2 //创建链表后,通过不重复的节点,遍历链表,找到待插入的值后,将链表插进去即可。 3 #include "iostream" 4 using namespace std; 5 struct ListNode 6 { 7 int
阅读全文
摘要:分析和思路:直接根据矩阵相乘规则进行循环计算赋值,注意循环程序的设计 1 // MatrixMulte.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "iostream" 5 using namespace std; 6 7 int main() 8 { 9 10 i
阅读全文
摘要:分析和思路:建立矩阵和输入字符的映射关系后,对表达式进行计算 1 // MatrixCalculate.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "string" 5 #include "map" 6 #include "iostream" 7 using nam
阅读全文
摘要:分析和思路:用一个新的字符串保存源字符串非数字的数字,在遇到数字时,进行处理 1 #if 1 2 #include "iostream" 3 #include "string" 4 using namespace std; 5 int main() 6 { 7 string temp; 8 whil
阅读全文
摘要:分析和思路:这个需要自己创建链表 1 #include "iostream" 2 3 using namespace std; 4 struct ListNode 5 { 6 7 int m_nKey; 8 9 ListNode* m_pNext; 10 11 }; 12 13 14 int mai
阅读全文
摘要:分析和思路: 接受输入数据后,从1开始遍历,找到连续相加和的连续奇数即可。back变量的设置有些技巧。 1 #include <iostream> 2 #include "iostream" 3 #include "string" 4 5 using namespace std; 6 7 int m
阅读全文
摘要:分析和思路:while循环判断是否是数字且相等,相等则进入循环,用变量保存较大值即可 1 // TheLongestNumber.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 2 // 3 #include <iostream> 4 #include "iostream"
阅读全文
摘要:分析和思路: 双重循环判断字符是否相等,相等即进入循环,注意退出循环后,要把索引回退到新的位置 1 #include "iostream" 2 #include "string" 3 4 using namespace std; 5 6 7 8 9 10 int main() 11 { 12 13
阅读全文
摘要:分析和思路:对一个整数进行分解,求出各位数值,判断是不是7即可 1 #include "iostream" 2 3 using namespace std; 4 5 bool getSevenCount(int input_number) 6 { 7 int temp=input_number; 8
阅读全文
摘要:分析和思路:用map建立字符映射,并赋值到pair结构里,然后用vector的sort 优先级排序 1 // PairTestTwo.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 2 // 3 4 #include <iostream> 5 #include <strin
阅读全文
摘要:分析和思路:遍历数字的每一位,遇到1的时候,进入while循环,用一个变量保存最大值,并更新 1 #include <iostream> 2 #include "iostream" 3 4 using namespace std; 5 6 int main() 7 { 8 int number =
阅读全文
摘要:分析和思路:直接按照题意,对字符进行映射。 注意字符和整数之间的转换 char-'0'=整数 整数+‘0’=字符 1 #include "iostream" 2 3 #include "string" 4 5 using namespace std; 6 7 int main() 8 { 9 10
阅读全文

浙公网安备 33010602011771号