随笔分类 -  my_小程序

各种小程序
摘要:代码弊端: 1.初始公式串的数值只能是0-9. 大于10的数字会有问题,可以改造myCopy函数 2. 计算顺序是从左到右。 比如2*3*4是先算的2*3 再算的rusult*4. 貌似c语言是从又到左的计算顺序 #include<iostream> #include<iomanip> #inclu 阅读全文
posted @ 2020-11-24 21:57 哈哈不是嘎嘎 阅读(188) 评论(0) 推荐(0)
摘要:#include<iostream> #include<iomanip> using namespace std; struct Node { public: Node():val(0),next(NULL){} Node(int v):val(v),next(NULL){} int val; No 阅读全文
posted @ 2020-11-18 20:34 哈哈不是嘎嘎 阅读(136) 评论(0) 推荐(0)
摘要:数组 : 1 4 7 9 12 45 56 [mayc@ ~/friendCode]$./test5find from 0 to 7find from 0 to 3find from 2 to 3find from 2 to 2没找到7find from 0 to 7find from 0 to 3 阅读全文
posted @ 2020-11-15 19:57 哈哈不是嘎嘎 阅读(80) 评论(0) 推荐(0)
摘要:1. 整数相除转成整数减法的程序 2. 二分查找法解整数相除 方式1 void showResult(const vector<char>& result) { for(int i = 0; i < result.size(); i++) { if(result[i] != '.') { cout 阅读全文
posted @ 2020-11-15 19:56 哈哈不是嘎嘎 阅读(791) 评论(0) 推荐(0)
摘要:0 回环 1 回环 11 回环 12 不回环 121 回环 1221 回环 12321 回环 123421 不回环 123311 不回环 #include<iostream> #include<cmath> using namespace std; int getNumberPow(int a) / 阅读全文
posted @ 2020-11-15 13:28 哈哈不是嘎嘎 阅读(585) 评论(0) 推荐(0)
摘要:#include<iostream> #include<vector> #include<string.h> #include<unistd.h> #include<stdlib.h> #include<stdio.h> using namespace std; int occupy[8][8] = 阅读全文
posted @ 2020-11-08 17:36 哈哈不是嘎嘎 阅读(139) 评论(0) 推荐(0)
摘要:分治算法技巧和原理: https://blog.csdn.net/weixin_44489823/article/details/92799755 这里假设m可以是个超大数, n也可以是个超大数。 所以用上 https://www.cnblogs.com/silentNight/p/13910510 阅读全文
posted @ 2020-11-02 18:43 哈哈不是嘎嘎 阅读(754) 评论(0) 推荐(0)
摘要:我们很容易理解两个超级大的整数的相加或者相乘不能用int,long, long long 来承载,因为还是很可能溢出。 我们c,c++语言起步的,很容易想到用char数组或者string来无限承载超大数。我开始也这么想的。后面突然想到vector<int>也可以承载。其实没有差别。 很多同学写不出两 阅读全文
posted @ 2020-11-01 18:09 哈哈不是嘎嘎 阅读(509) 评论(0) 推荐(0)
摘要:比如abc的组合类型 abc acb bac bca cab cba. 分析: 我们当然可以写三个嵌套的for循环去取,但是如果是abcd的组合呢? 还要修改代码添加一层for。 那如果是n个字母呢? 你又要手动添加多少层for呢? 所以需要一个忽视字母个数的实现。我们知道多层for(每次for里面 阅读全文
posted @ 2020-10-25 20:36 哈哈不是嘎嘎 阅读(766) 评论(0) 推荐(0)