【算法笔记自学】第 5 章 入门篇(3)——数学问题

5.1简单数学

#include <cstdio>
#include <algorithm>
using namespace std;
bool cmp(int a,int b){return a>b;
}
void to_array(int n,int num[]){for(int i=0;i<4;i++){num[i]=n%10;n /=10;}
}
int to_number(int num[]){int sum=0;for(int i=0;i<4;i++){sum=sum*10+num[i];}return sum;
}
int main(){int n,MIN,MAX;scanf("%d",&n);int num[5];while(1){to_array(n,num);sort(num,num+4);MIN=to_number(num);sort(num,num+4,cmp);MAX=to_number(num);n=MAX-MIN;printf("%04d-%04d=%04d\n",MAX,MIN,n);if(n==0||n==6174)break;}return 0;
}

#include <cstdio>
#include <cmath>int main() {int a, b, c;scanf("%d%d%d", &a, &b, &c);int delta = b * b - 4 * a * c;if (delta < 0) {printf("No Solution");} else if (delta == 0) {printf("%.2f", -b / (2.0 * a));} else {printf("%.2f %.2f",  (-b - sqrt((double)delta)) / (2.0 * a), (-b + sqrt((double)delta)) / (2.0 * a));}return 0;
}

5.2最大公约数与最小公倍数

#include <cstdio>
#include <cmath>
int gcd(int a,int b){if(b==0)return a;//求最大公约数的辗转相除法递归写法else return gcd(b,a%b);
}
int main() {int m,n;while(scanf("%d%d",&m,&n)!=EOF){printf("%d\n",gcd(m,n));}return 0;
}

#include <cstdio>int gcd(int a, int b) {if (b == 0) {return a;} else {return gcd(b, a % b);}
}int main() {int a, b;scanf("%d%d", &a, &b);printf("%d", a / gcd(a, b) * b);return 0;
}

5.3分数的四则运算

#include <cstdio>
#include <algorithm>
using namespace std;struct Fraction {int up, down;
};int gcd(int a, int b) {if (b == 0) {return a;} else {return gcd(b, a % b);}
}Fraction reduction(Fraction fraction) {if (fraction.down < 0) {fraction.up = -fraction.up;fraction.down = -fraction.down;}if (fraction.up == 0) {fraction.down = 1;} else {int d = gcd(abs(fraction.up), abs(fraction.down));fraction.up /= d;fraction.down /= d;}return fraction;
}int main() {Fraction fraction;scanf("%d%d", &fraction.up, &fraction.down);Fraction result = reduction(fraction);if (result.down == 1) {printf("%d", result.up);} else {printf("%d %d", result.up, result.down);}return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;struct Fraction {int up, down;
};int gcd(int a, int b) {if (b == 0) {return a;} else {return gcd(b, a % b);}
}Fraction reduction(Fraction fraction) {if (fraction.down < 0) {fraction.up = -fraction.up;fraction.down = -fraction.down;}if (fraction.up == 0) {fraction.down = 1;} else {int d = gcd(abs(fraction.up), abs(fraction.down));fraction.up /= d;fraction.down /= d;}return fraction;
}Fraction add(Fraction f1, Fraction f2) {Fraction result;result.up = f1.up * f2.down + f2.up * f1.down;result.down = f1.down * f2.down;return reduction(result);
}int main() {Fraction f1, f2;scanf("%d%d%d%d", &f1.up, &f1.down, &f2.up, &f2.down);Fraction result = add(f1, f2);if (result.down == 1) {printf("%d", result.up);} else {printf("%d %d", result.up, result.down);}return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;struct Fraction {int up, down;
};int gcd(int a, int b) {if (b == 0) {return a;} else {return gcd(b, a % b);}
}Fraction reduction(Fraction fraction) {if (fraction.down < 0) {fraction.up = -fraction.up;fraction.down = -fraction.down;}if (fraction.up == 0) {fraction.down = 1;} else {int d = gcd(abs(fraction.up), abs(fraction.down));fraction.up /= d;fraction.down /= d;}return fraction;
}Fraction sub(Fraction f1, Fraction f2) {Fraction result;result.up = f1.up * f2.down - f2.up * f1.down;result.down = f1.down * f2.down;return reduction(result);
}int main() {Fraction f1, f2;scanf("%d%d%d%d", &f1.up, &f1.down, &f2.up, &f2.down);Fraction result = sub(f1, f2);if (result.down == 1) {printf("%d", result.up);} else {printf("%d %d", result.up, result.down);}return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;struct Fraction {int up, down;
};int gcd(int a, int b) {if (b == 0) {return a;} else {return gcd(b, a % b);}
}Fraction reduction(Fraction fraction) {if (fraction.down < 0) {fraction.up = -fraction.up;fraction.down = -fraction.down;}if (fraction.up == 0) {fraction.down = 1;} else {int d = gcd(abs(fraction.up), abs(fraction.down));fraction.up /= d;fraction.down /= d;}return fraction;
}Fraction multiply(Fraction f1, Fraction f2) {Fraction result;result.up = f1.up * f2.up;result.down = f1.down * f2.down;return reduction(result);
}int main() {Fraction f1, f2;scanf("%d%d%d%d", &f1.up, &f1.down, &f2.up, &f2.down);Fraction result = multiply(f1, f2);if (result.down == 1) {printf("%d", result.up);} else {printf("%d %d", result.up, result.down);}return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;struct Fraction {int up, down;
};int gcd(int a, int b) {if (b == 0) {return a;} else {return gcd(b, a % b);}
}Fraction reduction(Fraction fraction) {if (fraction.down < 0) {fraction.up = -fraction.up;fraction.down = -fraction.down;}if (fraction.up == 0) {fraction.down = 1;} else {int d = gcd(abs(fraction.up), abs(fraction.down));fraction.up /= d;fraction.down /= d;}return fraction;
}Fraction div(Fraction f1, Fraction f2) {Fraction result;result.up = f1.up * f2.down;result.down = f1.down * f2.up;return reduction(result);
}int main() {Fraction f1, f2;scanf("%d%d%d%d", &f1.up, &f1.down, &f2.up, &f2.down);Fraction result = div(f1, f2);if(!f2.up){printf("undefined");}else if (result.down == 1) {printf("%d", result.up);} else {printf("%d %d", result.up, result.down);}return 0;
}

5.4素数 

#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
bool isPrime(int n){if(n<=1)return false;int sqr=(int)sqrt(1.0*n);for(int i=2;i<=sqr;i++){if(n%i==0)return false;}return true;}
int main() {int n;scanf("%d",&n);if(isPrime(n))printf("Yes");else printf("No");return 0;
}

#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
bool isPrime(int n){if(n<=1)return false;int sqr=(int)sqrt(1.0*n);for(int i=2;i<=sqr;i++){if(n%i==0)return false;}return true;}
int main() {int n;scanf("%d",&n);for(int i=1;i<n+1;i++){if(isPrime(i))printf("%d\n",i);}return 0;
}

5.5质因子分解

#include <cstdio>
int main() {int n;scanf("%d", &n);int counter = 0;while (n % 2 == 0) {counter++;n /= 2;}printf("%d", counter);return 0;
}

#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
using namespace std;const int MAXN = 1000 + 1;
bool isPrime[MAXN];
vector<int> primes;void getPrimes(int n) {memset(isPrime, true, sizeof(isPrime));for (int i = 2; i <= n; i++) {if (isPrime[i]) {primes.push_back(i);for (int j = i + i; j <= n; j += i) {isPrime[j] = false;}}}
}int main() {int n;scanf("%d", &n);getPrimes((int)sqrt(1.0 * n));for (int i = 0; i < primes.size() && n > 1; i++) {int counter = 0;while (n > 1 && n % primes[i] == 0) {counter++;n /= primes[i];}if (counter > 0) {printf("%d %d\n", primes[i], counter);}}if (n > 1) {printf("%d 1", n);}return 0;
}

5.6大整数运算 

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;typedef vector<int> BigInt;BigInt toBigInt(string nums) {BigInt result;for (int i = (int)nums.length() - 1; i >= 0; i--) {result.push_back(nums[i] - '0');}return result;
}int compare(BigInt a, BigInt b) {if (a.size() > b.size()) {return 1;} else if (a.size() < b.size()) {return -1;} else {for (int i = (int)a.size() - 1; i >= 0; i--) {if (a[i] > b[i]) {return 1;} else if (a[i] < b[i]) {return -1;}}return 0;}
}int main() {string nums1, nums2;cin >> nums1 >> nums2;BigInt a = toBigInt(nums1);BigInt b = toBigInt(nums2);int compareResult = compare(a, b);if (compareResult < 0) {printf("a < b");} else if (compareResult > 0) {printf("a > b");} else {printf("a = b");}
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;typedef vector<int> BigInt;BigInt toBigInt(string nums) {BigInt result;for (int i = (int)nums.length() - 1; i >= 0; i--) {result.push_back(nums[i] - '0');}return result;
}BigInt add(BigInt a, BigInt b) {BigInt c;int carry = 0;for (int i = 0; i < a.size() || i < b.size(); i++) {int aDigit = i < a.size() ? a[i] : 0;int bDigit = i < b.size() ? b[i] : 0;int sum = aDigit + bDigit + carry;c.push_back(sum % 10);carry = sum / 10;}if (carry) {c.push_back(carry);}return c;
}void print(BigInt a) {for (int i = (int)a.size() - 1; i >= 0; i--) {cout << a[i];}
}int main() {string nums1, nums2;cin >> nums1 >> nums2;BigInt a = toBigInt(nums1);BigInt b = toBigInt(nums2);print(add(a, b));return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;typedef vector<int> BigInt;BigInt toBigInt(string nums) {BigInt result;for (int i = (int)nums.length() - 1; i >= 0; i--) {result.push_back(nums[i] - '0');}return result;
}
int compare(BigInt a, BigInt b) {if (a.size() > b.size()) {return 1;} else if (a.size() < b.size()) {return -1;} else {for (int i = (int)a.size() - 1; i >= 0; i--) {if (a[i] > b[i]) {return 1;} else if (a[i] < b[i]) {return -1;}}return 0;}
}
BigInt sub(BigInt a, BigInt b) {BigInt c;for (int i = 0; i < a.size() || i < b.size(); i++) {int bDigit = i < b.size() ? b[i] : 0;if (a[i] < bDigit) {a[i + 1]--;a[i] += 10;}c.push_back(a[i] - bDigit);}while (c.size() > 1 && c.back() == 0) {c.pop_back();}return c;
}void print(BigInt a) {for (int i = (int)a.size() - 1; i >= 0; i--) {cout << a[i];}
}int main() {string nums1, nums2;cin >> nums1 >> nums2;BigInt a = toBigInt(nums1);BigInt b = toBigInt(nums2);if (compare(a, b) >= 0) {print(sub(a, b));} else {cout << "-";print(sub(b, a));}return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;typedef vector<int> BigInt;BigInt toBigInt(string nums) {BigInt result;for (int i = (int)nums.length() - 1; i >= 0; i--) {result.push_back(nums[i] - '0');}return result;
}
int compare(BigInt a, BigInt b) {if (a.size() > b.size()) {return 1;} else if (a.size() < b.size()) {return -1;} else {for (int i = (int)a.size() - 1; i >= 0; i--) {if (a[i] > b[i]) {return 1;} else if (a[i] < b[i]) {return -1;}}return 0;}
}
BigInt mul(BigInt a, int b) {BigInt c;int carry=0;;for (int i = 0; i < a.size(); i++) {int temp=a[i]*b+carry;c.push_back(temp%10);carry=temp/10;}while(carry!=0){c.push_back(carry%10);carry/=10;}while (c.size() > 1 && c.back() == 0) {c.pop_back();}return c;
}void print(BigInt a) {for (int i = (int)a.size() - 1; i >= 0; i--) {cout << a[i];}
}int main() {string nums;int b;cin >> nums >> b;BigInt a = toBigInt(nums);print(mul(a, b));return 0;return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;typedef vector<int> BigInt;BigInt toBigInt(string nums) {BigInt result;for (int i = (int)nums.length() - 1; i >= 0; i--) {result.push_back(nums[i] - '0');}return result;
}BigInt mul(BigInt a, BigInt b) {BigInt c = BigInt(a.size() + b.size() + 1, 0);for (int i = 0; i < a.size(); i++) {for (int j = 0; j < b.size(); j++) {c[i + j] += a[i] * b[j];}}for (int i = 0; i < a.size() + b.size(); i++) {if (c[i] >= 10) {c[i + 1] += c[i] / 10;c[i] = c[i] % 10;}}while (c.size() > 1 && c.back() == 0) {c.pop_back();}return c;
}void print(BigInt a) {for (int i = (int)a.size() - 1; i >= 0; i--) {cout << a[i];}
}int main() {string nums1, nums2;cin >> nums1 >> nums2;BigInt a = toBigInt(nums1);BigInt b = toBigInt(nums2);print(mul(a, b));return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;typedef vector<int> BigInt;BigInt toBigInt(string nums) {BigInt result;for (int i = (int)nums.length() - 1; i >= 0; i--) {result.push_back(nums[i] - '0');}return result;
}BigInt div(BigInt a, int b, int &r) {BigInt c;for (int i = (int)a.size() - 1; i >= 0; i--) {r = r * 10 + a[i];c.push_back(r / b);r = r % b;}reverse(c.begin(), c.end());while (c.size() > 1 && c.back() == 0) {c.pop_back();}return c;
}void print(BigInt a) {for (int i = (int)a.size() - 1; i >= 0; i--) {cout << a[i];}
}int main() {string nums;int b, r = 0;cin >> nums >> b;if (b == 0) {cout << "undefined";return 0;}BigInt a = toBigInt(nums);BigInt q = div(a, b, r);print(q);cout << " " << r;return 0;
}

5.7扩展欧几里得算法

#include <cstdio>
#include <algorithm>
using namespace std;int gcd(int a, int b) {if (b == 0) {return a;} else {return gcd(b, a % b);}
}int main() {int a, b, c;scanf("%d%d%d", &a, &b, &c);printf(c % gcd(a, b) == 0 ? "Yes" : "No");return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;int exGcd(int a, int b, int &x, int &y) {if (b == 0) {x = 1;y = 0;return a;}int d = exGcd(b, a % b, x, y);int temp = x;x = y;y = temp - a / b * y;return d;
}int main() {int a, b, x, y;scanf("%d%d", &a, &b);int d = exGcd(a, b, x, y);int step = b / d;int minX = (x % step + step) % step;printf("%d %d", minX, (d - a * minX) / b);return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;int exGcd(int a, int b, int &x, int &y) {if (b == 0) {x = 1;y = 0;return a;}int d = exGcd(b, a % b, x, y);int temp = x;x = y;y = temp - a / b * y;return d;
}int solve(int a, int b, int c) {int x, y;int d = exGcd(a, b, x, y);if (c % d) {return -1;} else {int step = abs(b / d);int minX = (c * x / d % step + step) % step;return minX;}
}int main() {int a, b, c;scanf("%d%d%d", &a, &b, &c);int minX = solve(a, b, c);if (minX == -1) {printf("No Solution");} else {printf("%d %d", minX, (c - a * minX) / b);}return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;int exGcd(int a, int b, int &x, int &y) {if (b == 0) {x = 1;y = 0;return a;}int d = exGcd(b, a % b, x, y);int temp = x;x = y;y = temp - a / b * y;return d;
}int solve(int a, int b, int c) {int x, y;int d = exGcd(a, b, x, y);if (c % d) {return -1;} else {int step = abs(b / d);int minX = (c * x / d % step + step) % step;return minX;}
}int main() {int a, c, m, x, y;scanf("%d%d%d", &a, &c, &m);int minX = solve(a, m, c);if (minX == -1) {printf("No Solution");} else {printf("%d", minX);}return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;int exGcd(int a, int b, int &x, int &y) {if (b == 0) {x = 1;y = 0;return a;}int d = exGcd(b, a % b, x, y);int temp = x;x = y;y = temp - a / b * y;return d;
}int invert(int a, int m) {int x, y;int d = exGcd(a, m, x, y);if (d != 1) {return -1;} else {return (x % m + m) % m;}
}int main() {int a, m;scanf("%d%d", &a, &m);int result = invert(a, m);if (result == -1) {printf("No Solution");} else {printf("%d", result);}return 0;
}

#include <cstdio>
#include <algorithm>
using namespace std;int exGcd(int a, int b, int &x, int &y) {if (b == 0) {x = 1;y = 0;return a;}int d = exGcd(b, a % b, x, y);int temp = x;x = y;y = temp - a / b * y;return d;
}int invert(int a, int m) {int x, y;int d = exGcd(a, m, x, y);if (d != 1) {return -1;} else {return (x % m + m) % m;}
}int main() {int n, a, m, b;scanf("%d%d%d", &n, &a, &m);int result = invert(abs(a), m);for (int i = 0; i < n; i++) {scanf("%d", &b);result = (result * b) % m;}printf("%d", result);return 0;
}

5.8组合数

#include <cstdio>
int cal(int n,int p)
{if(n<p)return 0;return n/p+cal(n/p,p);}
int main() {int n,p=2;scanf("%d", &n);printf("%d", cal(n,p));return 0;
}

#include <cstdio>typedef long long LL;LL C(LL n, LL m) {LL ans = 1;for (LL i = 1; i <= m; i++) {ans = ans * (n - m + i) / i;}return ans;
}int main() {LL n, m;scanf("%lld%lld", &n, &m);printf("%lld", C(n, m));return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/42309.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

AI微电影制作教程:轻松打造高清小人国画面

AI微电影作为一种新兴的视频内容形式&#xff0c;以其独特的视觉效果和制作技术在各大视频平台上取得了显著的流量表现。 2. AI微电影的特点 2.1 高清画质与流畅动作&#xff1a;AI微电影以其高分辨率和流畅的动作给观众带来优质的视觉体验。 2.2 微缩画面效果&#xff1a;独…

使用Docker、Docker-compose部署单机版达梦数据库(DM8)

安装前准备 Linux Centos7安装&#xff1a;https://blog.csdn.net/andyLyysh/article/details/127248551?spm1001.2014.3001.5502 Docker、Docker-compose安装&#xff1a;https://blog.csdn.net/andyLyysh/article/details/126738190?spm1001.2014.3001.5502 下载DM8镜像 …

自动控制:前馈控制

自动控制&#xff1a;前馈控制 前馈控制是一种在控制系统中通过预先计算和调整输入来应对已知扰动或变化的方法。相比于反馈控制&#xff0c;前馈控制能够更快速地响应系统的变化&#xff0c;因为它不依赖于系统输出的反馈信号。前馈控制的应用在工业过程中尤为广泛&#xff0…

element-ui输入框如何实现回显的多选样式?

废话不多说直接上效果&#x1f9d0; 效果图 <template><div><el-form:model"params"ref"queryForm"size"small":inline"true"label-width"68px"><el-form-item label"标签" prop"tag&q…

基于java+springboot+vue实现的仓库管理系统(文末源码+lw+ppt)23-499

第1章 绪论 伴随着信息社会的飞速发展&#xff0c;仓库管理所面临的问题也一个接一个的出现&#xff0c;所以现在最该解决的问题就是信息的实时查询和访问需求的问题&#xff0c;以及如何利用快捷便利的方式让访问者在广大信息系统中进行查询、分享、储存和管理。这对我们的现…

【第三版 系统集成项目管理工程师】第4章 信息系统架构

持续更新。。。。。。。。。。。。。。。 【第三版】系统集成项目管理工程师 考情分析4.1架构基础4.1.1指导思想&#xff08;非重点&#xff09; P1364.1.2设计原则&#xff08;非重点&#xff09; P1364.1.3建设目标&#xff08;非重点&#xff09; P1374.1.4总体框架 P138练习…

常见的Java运行时异常

常见的Java运行时异常 1、ArithmeticException&#xff08;算术异常&#xff09;2、ClassCastException &#xff08;类转换异常&#xff09;3、IllegalArgumentException &#xff08;非法参数异常&#xff09;4、IndexOutOfBoundsException &#xff08;下标越界异常&#xf…

windows无法访问github

##一、如果发现windows无法访问github时 一般就是我们的dns出现了问题&#xff0c;此时我们需要更换一个dns访问 ##二、解决方法 首先我们访问ip查询地址&#xff0c; https://ipchaxun.com/github.com/ 可更换下面历史ip进行测试&#xff0c;在windows的cmd里面输入ping git…

Python学习笔记31:进阶篇(二十)pygame的使用之图形绘制

前言 基础模块的知识通过这么长时间的学习已经有所了解&#xff0c;更加深入的话需要通过完成各种项目&#xff0c;在这个过程中逐渐学习&#xff0c;成长。 我们的下一步目标是完成python crash course中的外星人入侵项目&#xff0c;这是一个2D游戏项目。在这之前&#xff…

Day2用 rustlings 练习 Rust 语言-Move Semantics

大家好 今天 完成 2024年自动驾驶OS开发训练营-初阶营第四期-导学 Day2用 rustlings 练习 Rust 语言 -Move Semantics https://doc.rust-lang.org/stable/book/ch04-00-understanding-ownership.html 提交代码时候 提示 没有权限怎么出来 aciton 参考开发环境配置 https://rcor…

图片管理新纪元:高效批量横向拼接图片,一键生成灰色艺术效果,打造专业视觉体验!

在数字时代&#xff0c;图片已成为我们生活和工作中不可或缺的一部分。但面对海量的图片&#xff0c;如何高效地进行批量管理、拼接和调色&#xff0c;成为许多人面临的难题。今天&#xff0c;我们为您带来了一款颠覆性的图片管理工具&#xff0c;让您轻松实现图片批量横向拼接…

智慧生活新篇章,Vatee万腾平台领航前行

在21世纪的科技浪潮中&#xff0c;智慧生活已不再是一个遥远的梦想&#xff0c;而是正逐步成为我们日常生活的现实。从智能家居的温馨便捷&#xff0c;到智慧城市的高效运转&#xff0c;科技的每一次进步都在为我们的生活增添新的色彩。而在这场智慧生活的变革中&#xff0c;Va…

论文翻译 | (TAKE A STEP BACK) 后退一步:在大型语言模型中通过抽象来调用推理

摘要 我们介绍了STEP-BACK提示&#xff0c;这是一种简单的提示技术&#xff0c;使LLM能够进行抽象&#xff0c;从而从包含特定细节的实例中派生高级概念和第一原则。使用概念和原则来指导推理&#xff0c;LLM显着提高了他们遵循正确推理路径的能力。我们使用PaLM-2L、GPT-4和Ll…

Redis数据结构解析-RedisObject

文章目录 ☃️概述☃️源码 ☃️概述 RedisObject 是 Redis 中表示数据对象的结构体&#xff0c;它是 Redis 数据库中的基本数据类型的抽象。在 Redis 中&#xff0c;所有的数据都被存储为 RedisObject 类型的对象。 RedisObject 结构体定义如下&#xff08;简化版本&#xf…

kafka中

Kafka RocketMQ概述 RabbitMQ概述 ActiveMQ概述 ZeroMQ概述 MQ对比选型 适用场景-从公司基础建设力量角度出发 适用场景-从业务场景出发 Kafka配置介绍 运行Kafka 安装ELAK 配置EFAK EFAK界面 KAFKA常用术语 Kafka常用指令 Kafka中消息读取 单播消息 group.id 相同 多播消息 g…

MyBatis-Plus-实用的功能自动填充字段

前言: java项目用到了mybatis-plus&#xff0c;在一些类里面需要在更新时候&#xff0c;统一设置&#xff0c;修改人&#xff0c;修改ID&#xff0c;修改时间。新增时候设置 创建人&#xff0c;创建时间等 基础类&#xff1a; Data public abstract class BaseModel implements…

java 公共字段填充

公共字段填充 1、mybatis-plus2、mybatis 使用注解加aop2.1 自定义注解2.2 自定义切面类2.3 在mapper上添加上自定义的注解 1、mybatis-plus 通过在类上使用如下的注解 TableField(fill FieldFill.INSERT) 是 MyBatis-Plus 中的注解&#xff0c;用于自动填充字段的值。MyBat…

简单且循序渐进地查找软件中Bug的实用方法

“Bug”这个词常常让许多开发者感到头疼。即使是经验丰富、技术娴熟的开发人员在开发过程中也难以避免遭遇到 Bug。 软件中的故障会让程序员感到挫败。我相信在你的软件开发生涯中&#xff0c;也曾遇到过一些难以排查的问题。软件中的错误可能会导致项目无法按时交付。因此&…

Linux进程、线程——保姆级助理解

目录 1、进程&#xff08;Process&#xff09; 1.1 进程基本概念&#xff1a; 1.2 进程分类 1.3 进程的特征 1.4 进程和程序的区别 1.5 进程的状态 1.6 进程的创建——Fork()函数 1.6.1 简介 1.6.2 使用 1.7 进程终止 2、线程&#xff08;Thread&#xff09; 1.1 线…

Git管理源代码、git简介,工作区、暂存区和仓库区,git远程仓库github,创建远程仓库、配置SSH,克隆项目

学习目标 能够说出git的作用和管理源代码的特点能够如何创建git仓库并添加忽略文件能够使用add、commit、push、pull等命令实现源代码管理能够使用github远程仓库托管源代码能够说出代码冲突原因和解决办法能够说出 git 标签的作用能够使用使用git实现分支创建&#xff0c;合并…