1-2 暴力破解-模拟
模拟:根据题目要求编写代码
可分为:图形排版(根据某种规则输出特定图形)、日期问题、其他模拟
一.图形排版
1.输出梯形(清华大学)

法一:等差数列
分析:每行的星号个数为等差数列2n+2(n=1,2,3,…)
#include<iostream>
using namespace std;
int main() {int n = 0;cin >> n;for (int i = 1; i <= n; i++) {int j = 0;for (; j < 2 * n + 2 - (2 * i + 2); j++) {cout << " ";}for (; j < 2 * n + 2; j++) {cout << "*";}cout << endl;}
}
法二:梯形求解
分析:设第0行有h个星号,第1行有h+2个,第2行有h+2* 2个,第i行有h+2* i个
若该梯形的高为h,则最后一行是第h-1行,星号数为h+2* (h-1)
则第一行的空格数=h+2* (h-1)-h
第i行的空格数=h+2* (h-1)-(h+2* i)=2(h-1-i)个
即第i行的空格数为2(h-1-i)个,星号数为h+2* i个

#include<iostream>
using namespace std;
int main() {int h=0;while (scanf("%d",&h) != EOF) {for (int i = 0; i < h; i++) {for (int j = 0; j < 2 * (h - 1 - i); j++) {cout << " ";}for (int j = 0; j < h+2*i; j++) {cout << "*";}cout << endl;}}
}
2.叠筐(杭州电子科技大学-2074)



评测系统
法一:
#include<iostream>
using namespace std;
int main() {int n=0;char b, a;while (cin >> n) {cin >> b >> a;string out[100];int count = 0;//特殊处理if (n == 1) {cout << b <<endl << endl;continue;}//决定开头字符if ((n - 1) / 2 % 2 == 0) {int temp = a;a = b;b = temp;}//第一行out[count] += " ";for (int i = 0; i < n - 2; i++) {out[count] += a;}out[count] += " ";count++;//第二行往后int num = 0;char arr[100] = { 0 };for (int i = 0; i < n / 2; i++) {if (i) {int temp = a;a = b;b = temp;}arr[num] = a;arr[n - num] = a;for (int j = 0; j <= num; j++) {out[count] += arr[j];}for (int j = num + 1; j < n - num - 1; j++) {out[count] += b;}for (int j = n - num; j <= n; j++) {out[count] += arr[j];}num++;count++;}//输出for (int i = 0; i < count; i++) {cout << out[i] << endl;}for (int i = count - 2; i >= 0; i--) {cout << out[i] << endl;}cout << endl;}
}
法二:
先补全四个角,可以看出,这是一个同心正方形,边长为n

以最外层左上角为坐标原点(0,0),向下向右展开坐标轴,右下角坐标为(n-1,n-1),最外层正方形边长为n
对于任意内层正方形,设左上角的坐标为(i,i),右下角的坐标为(j,j),则该正方形边长为n-2i
(i,i)和(j,j)两坐标相加即可得到右下角的坐标(n-1,n-1),因此有等式i+j=n-1成立
i的取值从0到n/2,当i=n/2时为中心花色

设输入的第一个字符是B,第二个字符是A
中心花色是第一个输入字符

向外圈填充,距离中心距离为1填充字符为第二个输入字符

向外圈填充,距离为2填充第一个输入字符

以此类推,左上角坐标(i,i)距离中心的距离=n/2-i
距离为奇数填充第二个输入字符
距离为偶数填充第一个输入字符
char c;//当前圈层填充的字符
if ((n / 2 - i) % 2 == 0) {//偶数c = 第一个输入字符;
}
else {c = 第二个输入字符;
}

完整代码
#include<iostream>
using namespace std;
char matrix[80][80];//输出数组
int main() {int n;char a, b;bool firstCase = true;while (scanf("%d %c %c", &n, &a, &b) != EOF) {if (firstCase == true) {firstCase = false;//第一组前面无需换行}else { //在运行前先输出换行,确保两组用例之间有换行printf("\n");}for (int i = 0; i <= n / 2; i++) {//(i,i)为某正方形左上角坐标int j = n - 1 - i;//(j,j)为某正方形右下角坐标int length = n - 2 * i;//正方形边长char c;//当前圈层填充的字符if ((n / 2 - i) % 2 == 0) {//偶数c = a;}else {c = b;}for (int k = 0; k < length; k++) {//为当前圈层赋值matrix[i][i + k] = c;//上边赋值matrix[i+k][i] = c;//左边赋值matrix[j][j-k] = c;//下边赋值matrix[j-k][j] = c;//右边赋值}}if (n != 1) {//剔除四个角,确保外框尺寸n=1时也有输出,此时输出的是中心花色matrix[0][0] = ' ';matrix[0][n - 1] = ' ';matrix[n - 1][0] = ' ';matrix[n - 1][n - 1] = ' ';}for (int i = 0; i < n; i++) {//输出for (int j = 0; j < n; j++) {printf("%c", matrix[i][j]);}printf("\n");}}return 0;
}
3.Hello World for U(浙江大学)


评测系统
#include<iostream>
#include<string.h>
using namespace std;
int main() {string n;while (cin >> n) {int len = n.length();int n1, n2;int flag = 0;for (n1 = len - 1; n1 >= 2; n1--) {for (n2 = len - 1; n2 >= 3; n2--) {if (2 * n1 + n2 - 2 == len && n1 <= n2) {flag = 1;break;}}if (flag == 1) {break;}}flag = 0;char a[1000][1000];int num = 0;int i, j;for (i = 0; i < n1; i++) {a[i][0] = n[num];num++;}i -= 1;for (j = 1; j < n2; j++) {a[i][j] = n[num];num++;}j -= 1;for (int k = i - 1; k >= 0; k--) {a[k][j] = n[num];num++;}for (i = 0; i < n1 - 1; i++) {int ko = n2 - 2;cout << a[i][0];while (ko--) {cout << " ";}cout << a[i][n2 - 1] << endl;}for (j = 0; j < n2; j++) {cout << a[i][j];}cout << endl;}
}
二.日期问题

【求天数】
1.今年的第几天?(清华大学)

评测系统
#include<iostream>
#include<string.h>
using namespace std;
int count(int m,int y) {int sum=0;for (int i = 1; i <= m; i++) {if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) {sum += 31;}else if (i == 2) {if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) {sum += 29;}elsesum += 28;}elsesum += 30;}return sum;
}
int main() {int year, month, day;while (cin >> year >> month >> day) {cout << count(month - 1, year) + day << endl;}
}
另一种方式
#include<iostream>
#include<string.h>
using namespace std;
int daytab[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31},//不是闰年{0,31,29,31,30,31,30,31,31,30,31,30,31},//是闰年
};
bool IsLeapYear(int year) {//是否闰年return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
int main() {int year, month, day;int number=0;while (scanf("%d%d%d", &year, &month,&day) != EOF) {int number = 0;int row = IsLeapYear(year);for (int j = 0; j < month; ++j) {number += daytab[row][j];}number += day;printf("%d\n", number);}return 0;
}
【求日期B】
2.打印日期(华中科技大学)

评测系统
#include<iostream>
#include<string.h>
using namespace std;
int a[2];
void count(int y,int x) {int sum=0;int premonthday2 = 0;//上个月int premonthday3 = 0;//上上个月for (int i = 1; i <= 12; i++) {if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12) {sum += 31;premonthday2 = 31;}else if (i == 2) {if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) {sum += 29;premonthday2 = 29;}else {sum += 28;premonthday2 = 28;}}else {sum += 30;premonthday2 = 30;}if (x < sum) {if (i != 1) {a[0] = i;}else {a[0] = 1;}a[1] = x+premonthday2-sum;if (a[1] == 0) {a[0] -= 1;a[1] = premonthday3;}return;}premonthday3 = premonthday2;}
}
int main() {int year, month, day;int daycount;while (cin >> year>> daycount) {count(year,daycount);printf("%04d-%02d-%02d\n", year, a[0], a[1]);}
}
另一种方式
#include<iostream>
#include<string.h>
using namespace std;
int daytab[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31},//不是闰年{0,31,29,31,30,31,30,31,31,30,31,30,31},//是闰年
};
bool IsLeapYear(int year) {//是否闰年return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
int main() {int year, month, day;int number;while (scanf("%d%d", &year, &number) != EOF) {month = 0;int row = IsLeapYear(year);while (number > daytab[row][month]) {number -= daytab[row][month];month++;}day = number;printf("%04d-%02d-%02d\n", year, month, day);}return 0;
}
3.日期累加(北京理工大学)

评测系统
#include<iostream>
#include<string.h>
using namespace std;
int daytab[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31},//不是闰年{0,31,29,31,30,31,30,31,31,30,31,30,31},//是闰年
};
bool IsLeapYear(int year) {//是否闰年return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
int NumberOfYear(int year) {//返回该年天数if (IsLeapYear(year)) {return 366;}elsereturn 365;
}
int main() {int m = 0;cin >> m;int year, month, day,number;while (m--) {cin >> year >> month >> day >> number;int row = IsLeapYear(year);for (int j = 0; j < month; j++) {//加上今年已经过的天数number += daytab[row][j];}number += day;while (number > NumberOfYear(year)) {//确定年number -= NumberOfYear(year);year++;}month = 0;row = IsLeapYear(year);while (number > daytab[row][month]) {//确定月number -= daytab[row][month];month++;}day = number;//确定日printf("%04d-%02d-%02d\n", year, month, day);}return 0;
}
4.日期差值(上海交通大学)

评测系统
#include<iostream>
#include<string.h>
using namespace std;
int daytab[2][13] = {{0,31,28,31,30,31,30,31,31,30,31,30,31},//不是闰年{0,31,29,31,30,31,30,31,31,30,31,30,31},//是闰年
};
bool IsLeapYear(int year) {//是否闰年return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
int NumberOfYear(int year) {//返回该年天数if (IsLeapYear(year)) {return 366;}elsereturn 365;
}
int main() {string s1, s2;while (cin >> s1 >> s2) {int year1, month1, day1;int year2, month2, day2;int sum = 0;year1 = (s1[0] - 48) * 1000 + (s1[1] - 48) * 100 + (s1[2] - 48) * 10 + s1[3] - 48;year2 = (s2[0] - 48) * 1000 + (s2[1] - 48) * 100 + (s2[2] - 48) * 10 + s2[3] - 48;month1 = (s1[4] - 48) * 10 + s1[5] - 48;month2 = (s2[4] - 48) * 10 + s2[5] - 48;day1 = (s1[6] - 48) * 10 + s1[7] - 48;day2 = (s2[6] - 48) * 10 + s2[7] - 48;//处理中间年份for (int i = year1 + 1; i < year2; i++) {sum += NumberOfYear(i);}//处理两端年份if (month1 == month2) {if (day1 == day2) {sum += 0;}else {sum += abs(day1 - day2)+1;}}else {int row = IsLeapYear(year1);sum += daytab[row][month1] - day1 + 1;sum += day2;if (year1 == year2) {//没跨年,月份只会增大for (int i = month1 + 1; i < month2; i++) {sum += daytab[row][i];}}else {//跨年,分两段算for (int i = month1 + 1; i <= 12; i++) {sum += daytab[row][i];}for (int i = 1; i < month2; i++) {sum += daytab[row][i];}}}cout << sum << endl;}
}
5.Day of Week(上海交通大学)

评测系统
分析:
蔡勒公式
1.基本公式
日期≤1582年10月4日↓

日期>1582年10月4日↓

其中:
w是星期,w=0表示星期日,w=1表示星期一…
c是年份的前两位数
y是年份的后两位数
m是月份(一月m=13,二月m=14,三月m=3,四月m=4…十二月m=12)
当m=13或14时,年份要-1,即2003年变为2002年
如2002年2月5日
年份=2001
月份=14
日=5
也可采用 w=(day+2month+3(month+1)/5+year+year/4-year/100+year/400+1)%7
其中y为四位数的年份
#include<iostream>
#include<string.h>
#include<string>
using namespace std;
int main() {string s;while (getline(cin,s)) {int i;int year, year2, month, day;int yearnum, monthnum, daynum;year = month = day = year2= 0;yearnum = monthnum = daynum = 0;for (i=0; ; i++) {if (s[i] == ' ')break;day = day * 10 + s[i]-48;}daynum = i - 1;string month2;for (i += 1; ; i++) {if (s[i] == ' ')break;month2 += s[i];}if (month2 == "January") {month = 1;}else if (month2 == "February") {month = 2;}else if (month2 == "March") {month = 3;}else if (month2 == "April") {month = 4;}else if (month2 == "May") {month = 5;}else if (month2 == "June") {month = 6;}else if (month2 == "July") {month = 7;}else if (month2 == "August") {month = 8;}else if (month2 == "September") {month = 9;}else if (month2 == "October") {month = 10;}else if (month2 == "November") {month = 11;}else {month = 12;}i += 1;year = (s[i]-48) * 10 + (s[i + 1]-48);year2 = (s[i + 2]-48) * 10 + (s[i + 3]-48);if (month == 1) {month = 13;if (year2 != 0)year2--;elseyear--;} if (month == 2) {month = 14;if (year2 != 0)year2--;elseyear--;}int wee;if((year*100+year2<1582)||(year * 100 + year2==1582&&month<10)|| (year * 100 + year2 == 1582 && month == 10&&day<=4))wee = year2 + year2 / 4 + year / 4 - 2 * year + 26 * (month + 1) / 10 + day + 2;elsewee = year2 + year2 / 4 + year / 4 - 2 * year + 26 * (month + 1) / 10 + day - 1;if (wee < 0) {wee = (wee % 7 + 7) % 7;}elsewee = wee % 7;if (wee == 0) {cout << "Sunday" << endl;}else if (wee == 1) {cout << "Monday" << endl;}else if (wee == 2) {cout << "Tuesday" << endl;}else if (wee == 3) {cout << "Wednesday" << endl;}else if (wee == 4) {cout << "Thursday" << endl;}else if (wee == 5) {cout << "Friday" << endl;}else {cout << "Saturday" << endl;}}return 0;
}
6.日期类(北京理工大学)

评测系统
#include<iostream>
#include<string.h>
#include<string>
using namespace std;
int main() {int a[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };int m = 0;cin >> m;while (m--) {int year, month, day;cin >> year >> month >> day;if (month == 12 && day == 31) {year++;day = 1;month = 1;}else if (day == a[month]) {month++;day = 1;}else {day++;}printf("%04d-%02d-%02d\n", year, month, day);}
}
三.其他模拟
1.剩下的树(清华大学)

测评系统
分析:
设置一个数组,在给定区间内就将数值设为1,最后统计1的个数
#include<iostream>
#include<string.h>
using namespace std;
int main() {int a[10005] = { 0 };int len=0, group = 0;cin >> len >> group;for (int k = 0; k < group; k++) {int m, n;cin >> m >> n;for (int i = m; i <= n; i++) {a[i] = 1;}}int sum = 0;for (int k = 0; k < len; k++) {if (a[k] == 1)sum++;}cout << len + 1 - sum;
}
2.手机键盘(清华大学)

评测系统
分析:

每一个字母需要的按键次数

int keytab[26] = { 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4 };
判断两个字母是否位于同一个按键上

若在同一按键上,两个字母的差值=按键次数的差值
例如B-A=2-1=1
C-A=3-1=2
if (str[i] - str[i - 1] == keytab[str[i] - 'a'] - keytab[str[i - 1] - 'a']) {time += 2;
}
若不在同一按键上,两个字母的差值≠按键次数的差值
G-F≠1-3
完整代码
#include<iostream>
#include<string.h>
using namespace std;
int keytab[26] = { 1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,4,1,2,3,1,2,3,4 };
int main() {string str;while (cin >> str) {int time = 0;for (int i = 0; i < str.size(); i++) {time += keytab[str[i] - 'a'];//按键时间if (i != 0 && str[i] - str[i - 1] == keytab[str[i] - 'a'] - keytab[str[i - 1] - 'a']) {time += 2;}}cout << time << endl;}return 0;
}
3.XXX定律(浙江大学)

评测系统
#include<iostream>
using namespace std;
int main() {int n = 0;while (cin>>n) {if (n == 0)break;int num = 0;while (n != 1) {if (n % 2 == 0) {n /= 2;}else {n = (3 * n + 1) / 2;}num++;}cout << num << endl;}return 0;
}
4.Grading(浙江大学)

评测系统
#include<iostream>
using namespace std;
float max(float a, float b, float c) {if (a > b) {if (a > c) return a;elsereturn c;}else {if (b > c)return b;elsereturn c;}
}
int main() {float P, T, G1, G2, G3, GJ;cin >> P >> T >> G1 >> G2 >> G3 >> GJ;if (abs(G2 - G1) <= T) {printf("%.1f", (G1 + G2) / 2);}else {if ((abs(G3 - G1) <= T && abs(G3 - G2) > T)) {printf("%.1f", (G3 + G1) / 2);}else if (abs(G3 - G1) > T && abs(G3 - G2) <= T) {printf("%.1f", (G3 + G2) / 2);}else if (abs(G3 - G1) <= T && abs(G3 - G2) <= T) {printf("%.1f", max(G1, G2, G3));}else {printf("%.1f", GJ);}}
}
相关文章:
1-2 暴力破解-模拟
模拟:根据题目要求编写代码 可分为:图形排版(根据某种规则输出特定图形)、日期问题、其他模拟 一.图形排版 1.输出梯形(清华大学) 法一:等差数列 分析:每行的星号个数为等差数列2n2…...
机器学习中的Bagging思想
Bagging(Bootstrap Aggregating)是机器学习中一种集成学习方法,旨在提高模型的准确性和稳定性。Bagging的思想源自于Bootstrap采样技术,其基本原理如下: Bootstrap采样: Bagging的核心思想是通过对原始数据…...
基于PyTorch搭建你的生成对抗性网络
前言 你听说过GANs吗?还是你才刚刚开始学?GANs是2014年由蒙特利尔大学的学生 Ian Goodfellow 博士首次提出的。GANs最常见的例子是生成图像。有一个网站包含了不存在的人的面孔,便是一个常见的GANs应用示例。也是我们将要在本文中进行分享的…...
ROS话题(Topic)通信:自定义msg - 例程与讲解
在 ROS 通信协议中,数据是以约定好的结构传输的,即数据类型,比如Topic使用的msg,Service使用的srv,ROS 中的 std_msgs 封装了一些原生的数据类型,比如:Bool、Char、Float32、Int64、String等&am…...
【Vue配置项】 computed计算属性 | watch侦听属性
目录 前言 computed计算属性 什么是计算属性? Vue的原有属性是什么? 得到的全新的属性是什么? 计算属性怎么用? 计算属性的作用是什么? 为什么说代码执行率高了? computed计算属性中的this指向 co…...
linux 查看命令使用说明
查看命令的使用说明的命令有三种,但并不是每个命令都可以使用这三种命令去查看某个命令的使用说明,如果一种不行就使用另外一种试一试。 1.whatis 命令 概括命令的作用 2.命令 --help 命令的使用格式和选项的作用 3.man 命令 命令的作用和选项的详细…...
ceph修复pg inconsistent( scrub errors)
异常情况 1、收到异常情况如下: OSD_SCRUB_ERRORS 12 scrub errors PG_DAMAGED Possible data damage: 1 pg inconsistentpg 6.d is activeremappedinconsistentbackfill_wait, acting [5,7,4]2、查看详细信息 登录后复制 #ceph health detail HEALTH_ERR 12 scrub errors…...
【论文精读】VOYAGER: An Open-Ended Embodied Agent with Large Language Models
Understanding LSTM Networks 前言Abstract1 Introduction2 Method2.1 Automatic Curriculum2.2 Skill Library2.3 Iterative Prompting Mechanism 3 Experiments3.1 Experimental Setup3.2 Baselines3.3 Evaluation Results3.4 Ablation Studies3.5 Multimodal Feedback from …...
Linux安装DMETL5与卸载
Linux安装DMETL5与卸载 环境介绍1 DM8数据库配置1.1 DM8数据库安装1.2 初始化达梦数据库1.3 创建DMETL使用的数据库用户 2 配置DMETL52.1 解压DMETL5安装包2.2 安装调度器2.3 安装执行器2.4 安装管理器2.5 启动dmetl5 调度器2.6 启动dmetl5 执行器2.7 启动dmetl5 管理器2.8 查看…...
Office Word 中的宏
Office Word 中的宏 简介宏的使用将自定义创建的宏放入文档标题栏中的“自定义快速访问工具栏”插入指定格式、内容的字符选中word中的指定文字查找word中的指定文字A,并替换为指定文字B插入文本框并向内插入文字word 表格中的宏操作遍历表格中的所有内容批量设置表…...
qt中d指针
在Qt中,d指针是一种常见的设计模式,也称为"PIMPL"(Private Implementation)或者"Opaque Pointer"。它主要用于隐藏类的实现细节,提供了一种封装和隔离的方式,以便在不影响公共接口的情…...
交易者最看重什么?anzo Capital这点最重要!
交易者最看重什么?有人会说技术,有人会说交易策略,有人会说盈利,但anzo Capital认为Vishal 最看重的应该是眼睛吧! 29岁的Vishal Agraval在9年前因某种原因失去了视力,然而,他的失明并未能阻…...
window 搭建 MQTT 服务器并使用
1. 下载 安装 mosquitto 下载地址: http://mosquitto.org/files/binary/ win 使用 win32 看自己电脑下载相应版本: 一直安装: 记住安装路径:C:\Program Files\mosquitto 修改配置文件: allow_anonymous false 设置…...
Prometheus+Ansible+Consul实现服务发现
一、简介 1、Consul简介 Consul 是基于 GO 语言开发的开源工具,主要面向分布式,服务化的系统提供服务注册、服务发现和配置管理的功能。Consul 提供服务注册/发现、健康检查、Key/Value存储、多数据中心和分布式一致性保证等功能。 在没有使用 consul 服…...
【原创】java+swing+mysql校园活动管理系统设计与实现
前言: 本文介绍了一个校园活动管理系统的设计与实现。该系统基于JavaSwing技术,采用C/S架构,使用Java语言开发,以MySQL作为数据库。系统实现了活动发布、活动报名、活动列表查看等功能,方便了校园活动的发布和管理&am…...
vscode中vue项目引入的组件的颜色没区分解决办法
vscode中vue项目引入的组件的颜色没区分解决办法 图中引入组件和其他标签颜色一样没有区分,让开发者不易区分,很蓝瘦 这个就很直观,解决办法就是你当前的vscode版本不对,你得去找找其他版本,我的解决办法就是去官网历…...
uniapp: 实现pdf预览功能
目录 第一章 实现效果 第二章 了解并解决需求 2.1 了解需求 2.2 解决需求 2.2.1 方法一 2.2.2 方法二 第三章 资源下载 第一章 实现效果 第二章 了解并解决需求 2.1 了解需求 前端需要利用后端传的pdf临时路径实现H5端以及app端的pdf预览首先我们别像pc端一样&#…...
【Pytorch笔记】7.torch.nn (Convolution Layers)
我们常用torch.nn来封装网络,torch.nn为我们封装好了很多神经网络中不同的层,如卷积层、池化层、归一化层等。我们会把这些层像是串成一个牛肉串一样串起来,形成网络。 先从最简单的,都有哪些层开始学起。 Convolution Layers -…...
MySQL内部组件与日志详解
MySQL的内部组件结构 MySQL 可以分为 Server 层和存储引擎层两部分。 Server 层主要包括连接器、查询缓存、分析器、优化器、执行器等,涵盖 MySQL 的大多数核心服务功能,以及所有的内置函数(如日期、时间、数学和加密函数等)&am…...
【LeetCode】94. 二叉树的中序遍历
94. 二叉树的中序遍历 难度:简单 题目 给定一个二叉树的根节点 root ,返回 它的 中序 遍历 。 示例 1: 输入:root [1,null,2,3] 输出:[1,3,2]示例 2: 输入:root [] 输出:[]示…...
23-Oracle 23 ai 区块链表(Blockchain Table)
小伙伴有没有在金融强合规的领域中遇见,必须要保持数据不可变,管理员都无法修改和留痕的要求。比如医疗的电子病历中,影像检查检验结果不可篡改行的,药品追溯过程中数据只可插入无法删除的特性需求;登录日志、修改日志…...
Golang dig框架与GraphQL的完美结合
将 Go 的 Dig 依赖注入框架与 GraphQL 结合使用,可以显著提升应用程序的可维护性、可测试性以及灵活性。 Dig 是一个强大的依赖注入容器,能够帮助开发者更好地管理复杂的依赖关系,而 GraphQL 则是一种用于 API 的查询语言,能够提…...
Springcloud:Eureka 高可用集群搭建实战(服务注册与发现的底层原理与避坑指南)
引言:为什么 Eureka 依然是存量系统的核心? 尽管 Nacos 等新注册中心崛起,但金融、电力等保守行业仍有大量系统运行在 Eureka 上。理解其高可用设计与自我保护机制,是保障分布式系统稳定的必修课。本文将手把手带你搭建生产级 Eur…...
WordPress插件:AI多语言写作与智能配图、免费AI模型、SEO文章生成
厌倦手动写WordPress文章?AI自动生成,效率提升10倍! 支持多语言、自动配图、定时发布,让内容创作更轻松! AI内容生成 → 不想每天写文章?AI一键生成高质量内容!多语言支持 → 跨境电商必备&am…...
AspectJ 在 Android 中的完整使用指南
一、环境配置(Gradle 7.0 适配) 1. 项目级 build.gradle // 注意:沪江插件已停更,推荐官方兼容方案 buildscript {dependencies {classpath org.aspectj:aspectjtools:1.9.9.1 // AspectJ 工具} } 2. 模块级 build.gradle plu…...
【从零学习JVM|第三篇】类的生命周期(高频面试题)
前言: 在Java编程中,类的生命周期是指类从被加载到内存中开始,到被卸载出内存为止的整个过程。了解类的生命周期对于理解Java程序的运行机制以及性能优化非常重要。本文会深入探寻类的生命周期,让读者对此有深刻印象。 目录 …...
微服务通信安全:深入解析mTLS的原理与实践
🔥「炎码工坊」技术弹药已装填! 点击关注 → 解锁工业级干货【工具实测|项目避坑|源码燃烧指南】 一、引言:微服务时代的通信安全挑战 随着云原生和微服务架构的普及,服务间的通信安全成为系统设计的核心议题。传统的单体架构中&…...
企业大模型服务合规指南:深度解析备案与登记制度
伴随AI技术的爆炸式发展,尤其是大模型(LLM)在各行各业的深度应用和整合,企业利用AI技术提升效率、创新服务的步伐不断加快。无论是像DeepSeek这样的前沿技术提供者,还是积极拥抱AI转型的传统企业,在面向公众…...
解析“道作为序位生成器”的核心原理
解析“道作为序位生成器”的核心原理 以下完整展开道函数的零点调控机制,重点解析"道作为序位生成器"的核心原理与实现框架: 一、道函数的零点调控机制 1. 道作为序位生成器 道在认知坐标系$(x_{\text{物}}, y_{\text{意}}, z_{\text{文}}…...
2025年- H71-Lc179--39.组合总和(回溯,组合)--Java版
1.题目描述 2.思路 当前的元素可以重复使用。 (1)确定回溯算法函数的参数和返回值(一般是void类型) (2)因为是用递归实现的,所以我们要确定终止条件 (3)单层搜索逻辑 二…...
