数组和方法

news/2025/2/7 14:48:37/文章来源:https://www.cnblogs.com/HanMengzhen/p/18702555

数组定义(静态初始化):

int[] a={0,1,2,3,4,5};              // 定义一个int数组              方法1int[] a=new int[]{1,2,3,4,5};       // 创建一个int类型的数组对象      方法2double[] b={1.1,2.6,3.5,4.0,5.1};   // 定义一个double类型的数组String[] n={"张三",“李四”,“王五”};

数组打印:

package demon;import java.util.Arrays;public class d1 {public static void main(String[] args) {Double[] a=new Double[]{1.1,2.3,3.0,4.0,5.0};System.out.println(Arrays.toString(a));        // Arrays跟Array不一样,打印字符只能用Arrays.toString}
}//  直接打印int数组      System.out.println(a);    [I@4554617c                  
//  直接打印Double数组   System.out.println(a);    [Ljava.lang.Double;@4554617c
//  [ : 表示当前是一个数组
//  I : 表示当前是int类型
//  @ : 表示间隔符号(固定类型)
//  4554617c : 数组真正的地址[1.1, 2.3, 3.0, 4.0, 5.0]

数组的遍历

package demon;
public class d1 {public static void main(String[] args) {int[] a={1,2,3,35,47,51,65,73,28,92,96};System.out.print("["+"\t");for (int i = 0; i < a.length; i++) {       // 利用for循环将数组进行打印System.out.print(a[i]+"\t");}System.out.print("]");}
}[	1	2	3	35	47	51	65	73	28	92	96	]

案例:统计个数

/* 定义一个数组,存储1,2,3,4,5,6,7,8,9,10
遍历数组得到每一个元素,统计数组里面一共多少个能被3整除的数字*/package demon;
public class d1 {public static void main(String[] args) {int[] a={1,2,3,4,5,6,7,8,9,10};int sum=0;for (int i = 0; i < a.length; i++) {      // i表示索引if (a[i]%3==0){sum++;}}System.out.println(sum);}
}3

案例:奇偶变化

// 如果是奇数扩大两倍,偶数缩小两倍package demon;
public class d1 {public static void main(String[] args) {int[] a={1,2,3,4,5,6,7,8,9,10};int sum=0;for (int i = 0; i < a.length; i++) {if (a[i]%2==0){a[i]=a[i]/2;}else {a[i]=a[i]*2;}System.out.print(a[i]+"\t");}// for (int i = 0; i < a.length; i++) {// System.out.print(a[i]+"\t");  // 可以不写这句代码System.out.print(a[i]+"\t");直接写上方两句代码}
}2	1	6	2	10	3	14	4	18	5// 静态初始化

数组定义(动态初始化):

int[] a=new int[5];    // 定义一个int数组,数组有5个元素// 整数,小数类型默认值是:0和0.0     引用类型默认值是:null     boolean默认值是:false    字符类型默认值是:'\u0000'空格

案例:求最值

package demon;public class d2 {public static void main(String[] args) {int[] a={2,45,7,39,20,30};int max=a[0];                                  //int max不能等于0只能是数组中第一个元素for (int i = 1; i < a.length; i++) {if (max<a[i]){max=a[i];}} System.out.println(max);}
}45

案例:随机数求(和,平均,最小数)

/*生成1-100之间的随机数存入数组
1)求所有数据和
2)求数据平均数
3)统计多少个数据小于平均数*/package demon;import java.util.Random;public class d2 {public static void main(String[] args) {Random r=new Random();int sum=0;int average=0;int small=0;for (int i = 0; i < 10; i++) {int a=r.nextInt(100)+1;System.out.print(a+"\t");sum=sum+a;average=sum/10;if (a<average){small++;}}System.out.println();System.out.println("总和"+sum);System.out.println("平均数"+average);System.out.println("小于平均数的个数"+small);}
}53	73	48	46	46	11	99	10	77	90	
总和553
平均数55
小于平均数的个数2// 方法1    直接引用不定义数组
/*生成1-100之间的随机数存入数组
1)求所有数据和
2)求数据平均数
3)统计多少个数据小于平均数*/package demon;import java.util.Random;public class d {public static void main(String[] args) {int[] a=new int[10];int sum=0;int average=0;int small=0;Random m =new Random();for (int i = 0; i < a.length; i++) {int b=m.nextInt(100)+1;a[i]=b;}for (int i = 0; i < a.length; i++) {System.out.print(a[i]+"\t");sum+=a[i];average=sum/10;if (average>a[i]){small++;}}System.out.println();System.out.println("总和"+sum);System.out.println("平均数"+average);System.out.println("小于平均数的个数"+small);}
}56	41	70	94	32	6	25	22	44	47	
总和437
平均数43
小于平均数的个数3// 方法2   定义数组进行引用(老师用的方法)

案例:交换两变量代码

package demon;public class d3 {public static void main(String[] args) {int a=10;int b=20;int temp=0;temp=a;a=b;b=temp;System.out.println(a);System.out.println(b);}
}20
10
//将定义的数组1,2,3,4,5转换成5,2,3,4,1package demon;public class d3 {public static void main(String[] args) {int[] a={1,2,3,4,5};int temp=0;temp=a[0];a[0]=a[4];a[4]=temp;for (int i = 0; i < a.length; i++) {System.out.print(a[i]+"\t");}}
}5	2	3	4	1	

冒泡排序

package demon;public class d5 {public static void main(String[] args) {int[] a={1,6,4,9,2};int temp=0;for (int i = 0; i < a.length-1; i++) {for (int j = 0; j < a.length-1-i; j++) {if (a[j]>a[j+1]){temp=a[j];a[j]=a[j+1];a[j+1]=temp;}}}for (int i = 0; i < a.length; i++) {System.out.print(a[i]+"\t");}}
}1	2	4	6	9

实参

getSum(20,30);

形参

getSum(int num1,int num2);

直接调用(无返回值时使用)--在定义方法中进行sout输出

package demon;public class d3 {public static void main(String[] args) {hello(10, 20);                        // 直接定义参数,在定义的方法中进行输出}public static void hello(int a, int b) {int m = a + b;System.out.println(m);                // 在此方法中输出}
}30

赋值调用(有返回值时使用)--需要sout进行输出

package demon;public class d3 {public static void main(String[] args) {int ko=hello(10,20);                    // 先定义参数System.out.println(ko);                 // 再进行输出}public static int hello(int a,int b) {int m=a+b;return m;}
}30

输出调用 --在输出的时候定义参数

package demon;public class d3 {public static void main(String[] args) {System.out.println(hello(10,20));       // 在输出的时候定义参数}public static int hello(int a,int b) {int m=a+b;return m;}
}30

案例:判断长方形周长大小

package demon;public class d3 {public static void main(String[] args) {int l=hello(6,9);                         // 将方法调用和判断int m=hello(10, 20);if (l>m){System.out.println(l+"大于"+m);}else {System.out.println(m+"大于"+l);}}public static int hello(int a, int b) {       // 进行方法的定义int m = (a + b)*2;return m;}
}60大于30

方法注意事项

  • 方法不调用不会执行
  • 方法不能嵌套使用
  • 方法执行顺序与编写顺序无关,先调用先执行
  • 除了void,final,private不需要写返回值return(结束方法),其他类都需要有返回值
  • return下面不能写其他代码,永远执行不到

方法重载

同一类中方法名相同但参数不同的方法体

package demon;public class d3 {                                                 // 类的定义public static void main(String[] args) {                      // 运行环境             }public static int hello(int a, int b) {                       // 方法的定义int m = (a + b) * 2;return m;}public static int hello(int a, int b, int c) {int m = (a + b + c) * 2;return m;}public static int hello(int a, int b, int c, int d) {int m = (a + b + c + d) * 2;return m;}
}

![623ca47351610fbfb9984382b8e20e9](D:\WeChat Files\wxid_6no8nh20sfwy22\FileStorage\Temp\623ca47351610fbfb9984382b8e20e9.jpg)

强转调用

package demon;public class d3 {public static void main(String[] args) {hello((short) 10,(short)20);                // 强转调用}public static void hello(int a, int b) {int m = (a + b) * 2;System.out.println("int");}public static void hello(byte a, byte b) {int m = (a + b ) * 2;System.out.println("byte");}public static void hello(short a, short b) {int m = (a + b) * 2;System.out.println("short");}
}short// 方法1
package demon;public class d3 {public static void main(String[] args) {short d=10;                                // 定义及调用short o=20;hello(d,o);}public static void hello(int a, int b) {int m = (a + b) * 2;System.out.println("int");}public static void hello(byte a, byte b) {int m = (a + b ) * 2;System.out.println("byte");}public static void hello(short a, short b) {int m = (a + b) * 2;System.out.println("short");}
}short// 方法2

案例:数组遍历

// 打印数组{	1	2	3	4	5	}package demon;public class d3 {public static void main(String[] args) {int[] a={1,2,3,4,5};hello(a);}public static void hello(int[] a) {System.out.print("{"+"\t");for (int i = 0; i <a.length; i++) {System.out.print(a[i]+"\t");}System.out.print("}");}
}{	1	2	3	4	5	}

案例;数组最大值

package demon;public class d3 {public static void main(String[] args) {int[] a={4,2,6,9,10};hello(a);}public static void hello(int[] a) {int v=a[0];for (int i = 1; i < a.length; i++) {if (v<a[i]){v=a[i];}}System.out.println(v);}
}10// 无返回值
package demon;public class d3 {public static void main(String[] args) {int[] a={4,2,6,9,10};int i=hello(a);System.out.println(i);}public static int hello(int[] a) {int v=a[0];for (int i = 1; i < a.length; i++) {if (v<a[i]){v=a[i];}}return v;}
}10// 有返回值

案例:判断查找数是否在数组中

package demon;
public class d1 {public static void main(String[] args) {int[] a={1,6,6,9,29,10};int b=6;boolean b1 = judgeA(a, b);System.out.println(b1);}public static boolean judgeA(int[] a,int b) {for (int i = 0; i < a.length; i++) {if (a[i]==b){return true;}}return false;}
}true// 有返回值类型 ***
package demon;
public class d1 {public static void main(String[] args) {int[] a={1,6,6,9,29,10};int b=6;judgeA(a, b);}public static void judgeA(int[] a,int b) {for (int i = 0; i < a.length; i++) {if (a[i] == b) {System.out.println("有数值匹配");break;} else {System.out.println("数值不匹配");break;}}}
}数值不匹配//无返回值类型

return跟break:

案例:复制数组

/*定义一个方法a(int[] b,int from,int to)
将b数组中第form到to索引的数组打印并返回*/package demon;public class d1 {public static void main(String[] args) {int[] a = {1, 6, 6, 9, 29, 10};judgeA(a, 2, 4);}public static void judgeA(int[] a, int b, int c) {for (int i = b ; i < c + 1; i++) {System.out.println(a[i]);}}
}6
9
29// 直接调用***
package demon;public class d1 {public static void main(String[] args) {int[] a={1,2,3,4,5,6,7,8,9};copyRang(a,2,7);}public static void copyRang(int[] a,int b,int c){int[] arr=new int[c-b+1];int d=0;for (int i = b; i < c+1; i++) {arr[d]=a[i];System.out.print(arr[d]+"\t");             // 打印arr[d]d++;                                       // d++跟上一行代码顺序不能调换,会报错   }}
}3	4	5	6	7	8	// 通过定义数组直接调用****
package demon;public class d1 {public static void main(String[] args) {int[] a={1,2,3,4,5,6,7,8,9};int[] copied = copyRang(a, 2, 7);for (int i = 0; i < copied.length; i++) {      //在输出循环语句是必须要先进行遍历System.out.print(copied[i]+"\t");}}public static int[] copyRang(int[] a,int b,int c){int[] arr=new int[c-b+1];int d=0;for (int i = b; i < c+1; i++) {arr[d]=a[i]; d++;}return arr;}
}3	4	5	6	7	8	// 赋值调用****
  • return(结束方法返回结果)跟方法有关,方法中执行到return该方法就终止

基本数据类型和引用数据类型

        int a=10;int b=a;                // 传递的是真实数据//基本数据类型,在栈里面,不容易改变int[] arr1={1,2,3,4,5};int[] arr2=arr1;        // 传递的是地址值//引用数据类型,在堆里面,容易改变

基本数据类型传递:

package demon;public class d1 {public static void main(String[] args) {int a=100;System.out.println(a);change(a);System.out.println(a);}public static void change(int a){a=200;}
}100
100
package demon;public class d1 {public static void main(String[] args) {int a=100;System.out.println(a);int change = change(a);System.out.println(change);}public static int change(int a){a=200;return a;}
}100
200

传递基本数据类型,传递真实数据时,无返回值的形参改变不影响实际参数值

通过给返回值的方式可以强行改变数据类型

看有没有new——new了方法里变量改变调用值就会变

案例:机票打折

package demon;import java.util.Scanner;public class d1 {public static void main(String[] args) {Scanner a = new Scanner(System.in);System.out.println("输入月份");int b =a.nextInt(12);System.out.println("输入钱数");int j =a.nextInt();edisPort(b,j);mdisPort(b,j);a.close();}public static void edisPort(int b,double j) {if (b > 4 && b < 11 ) {if (j == 500) {j = j * 0.9;} else {j = j * 0.85;}System.out.println(j);}}public static void mdisPort(int b,double j){if ((a <= 4 && a >= 1)||(a <= 12)){if (j==500){j=j*0.7;}else {j=j*0.65;}}System.out.println(j);}
}
package demon;import java.util.Scanner;public class d1 {public static void main(String[] args) {Scanner m = new Scanner(System.in);System.out.println("输入月份");int a = m.nextInt();System.out.println("输入钱数");Double b = m.nextDouble();System.out.println("输入舱数,0代表头等舱,1代表经济舱");int c = m.nextInt();if (a <= 11 && a >= 5) {hello(a, b, c);}else if ((a <= 4 && a >= 1)||(a <= 12))  {hello1(a, b, c);}else {System.out.println("输入错误");m.close();}}public static void hello ( int a, Double b,int c){if (c == 0) {b = b * 0.9;} else {b = b * 0.85;}System.out.println(b);}public static void hello1 ( int a, Double b,int c){if (c == 0) {b = b * 0.7;} else {b = b * 0.65;}System.out.println(b);}}输入月份
5
输入钱数
600
输入舱数,0代表头等舱,1代表经济舱
0
540.0

案例:101到200之间质数个数

package ko;public class light {public static void main(String[] args) {int sum = 0;for (int i = 101; i < 201; i++) {boolean flag = true;for (int j = 2; j < i; j++) {if (i % j == 0) {flag = false;break;}}if (flag) {System.out.print(i+"\t");sum++;}if (i % 50 == 0) {System.out.println();}}System.out.println("一共有"+sum+"个质数");}
}101	103	107	109	113	127	131	137	139	149	
151	157	163	167	173	179	181	191	193	197	199	
一共有21个质数

案例:验证码

package ko;import java.util.Random;public class d3 {public static void main(String[] args) {Random r = new Random();int a = r.nextInt(26)+65;int b = r.nextInt(26)+65;int c = r.nextInt(26)+97;int d = r.nextInt(26)+97;int e = r.nextInt(10);char f = (char) a;char g = (char) b;char h = (char) c;char i = (char) d;System.out.println(f+""+g+""+h+""+i+""+e);}
}YNwb0
package demon;import java.util.Random;public class d5 {public static void main(String[] args) {Random r = new Random();int a = r.nextInt(26)+65;              // 自动生成大写字母int b = r.nextInt(26)+65;int c = r.nextInt(26)+97;              // 自动生成小写字母int d = r.nextInt(26)+97;int e = r.nextInt(10);                 // 生成0-9之间的数字extracted(a,b,c,d,e,r);}public static void extracted(int a,int b,int c,int d,int e,Random r) {char f = (char) a;char g = (char) b;char h = (char) c;char i = (char) d;System.out.println(f+""+g+""+h+""+i+""+e);}
}KUzf4

案例:评委打分***

package demon;import java.util.Scanner;public class d7 {public static void main(String[] args) {Scanner m = new Scanner(System.in);int[] a = new int[6];int judge = 0;while (judge < a.length) {System.out.println("输入你心目中的分数");int peJu = m.nextInt();if (peJu <= 100 && peJu >= 0) {a[judge] = peJu;judge++;} else {System.out.println("输入错误");continue;}}for (int i = 0; i < a.length; i++) {System.out.print(a[i]+" ");           //输出谁[]括号就写谁,这里定义是i不是judge}m.close();}
}输入你心目中的分数
50
输入你心目中的分数
60
输入你心目中的分数
40
输入你心目中的分数
30
输入你心目中的分数
20
输入你心目中的分数
10
50 60 40 30 20 10 
package demon;import java.util.Scanner;public class d7 {public static void main(String[] args) {             // 定义输出评委打分Scanner m = new Scanner(System.in);int[] a = new int[6];int judge = 0;while (judge < a.length) {System.out.println("输入你心目中的分数");int peJu = m.nextInt();if (peJu <= 100 && peJu >= 0) {a[judge] = peJu;judge++;} else {System.out.println("输入错误");continue;}}for (int i = 0; i < a.length; i++) {System.out.print(a[i]+" ");}m.close();int max=getMax(a);                                // 方法调用打印int min=getMin(a);int sum=getSum(a);System.out.println();System.out.println(sum-(max+min));System.out.println((sum-(max+min))/(a.length-2));}public static int getMax(int[] a){                    // max方法int max=a[0];for (int i = 1; i < a.length; i++) {if (max<a[i]){max=a[i];}}return max;}public static int getMin(int[] a){                    // min方法int min=a[0];for (int i = 1; i < a.length; i++) {if (min>a[i]){min=a[i];}}return min;}public static int getSum(int[] a){                    // sum方法int sum=0;for (int i = 0; i < a.length; i++) {sum+=a[i];}return sum;}
}输入你心目中的分数
10
输入你心目中的分数
90
输入你心目中的分数
50
输入你心目中的分数
50
输入你心目中的分数
50
输入你心目中的分数
50
10 90 50 50 50 50 
200
50// *****

数字加密***

package demon;import java.util.Scanner;public class d5 {public static void main(String[] args) {Scanner S=new Scanner(System.in);       // 定义输入值System.out.println("输入数字");int a=S.nextInt();code(a);S.close();}public static void code(int a) {             // 定义取出末尾数的方法int[] b=new int[4];int ge=0;for (int i = 0; i <b.length; i++) {ge=((a%10)+5)%10;                     // 取出a结尾的数b[i]=ge;a/=10;                                // 一定不要忘记更新输入的值}for (int i = 0; i < b.length; i++) {      // 正序遍历数组System.out.print(b[i]+"");}}
}输入数字
1234
9876

数字解密***

package demon;import java.util.Scanner;public class d5 {public static void main(String[] args) {Scanner S=new Scanner(System.in);System.out.println("输入数字");int a=S.nextInt();code(a);S.close();}public static void code(int a) {              // 定义取出末尾数的方法int[] b=new int[4];int ge=0;for (int i = 0; i <b.length; i++) {           ge=((a%10)+5)%10;                     // 取出a结尾的数               b[i]=ge;a/=10;                                // 一定不要忘记更新输入的值                                     }for (int i = b.length-1; i >=0; i--) {    // 倒序遍历数组System.out.print(b[i]+"");}}
}输入数字
8710
3265

加密和解密用的公式都是一样的,只有最后遍历的时候不一样,一个是正序一个是倒序

案例:抽奖********

package demon;import java.util.Random;public class d5 {public static void main(String[] args) {int[] arr={2,588,888,1000,10000};                   // 定义数组int[] newArr=new int[arr.length];                   // 定义新数组用于存储抽奖结果Random r = new Random();for (int i = 0; i < 5; i++) {int rute=r.nextInt(arr.length);int price=arr[rute];boolean flage = contanis(newArr,price);if(!flage){newArr[i]=price;i++;}}for (int i = 0; i < newArr.length; i++) {System.out.println(newArr[i]);}}public static boolean contanis(int[] arr, int price) {for (int i = 0; i < arr.length; i++) {if (arr[i] == price) {return true;}}return false;}
}2
0
10000
0
588

案例:彩票(未完待续)

package demon;import java.util.Random;
import java.util.Scanner;public class d5 {public static void main(String[] args) {Random r=new Random();Scanner m=new Scanner(System.in);int[] b=new int[6];for (int i = 0; i <6; i++) {int a=r.nextInt(31)+1;b[i]=a;System.out.print(b[i]+" ");}int c=r.nextInt(16)+1;System.out.println(c);int[] inPut=new int[6];for (int i = 0; i < b.length; i++) {System.out.println("输入数字");int d=m.nextInt();inPut[i]=d;}int right=m.nextInt();boolean ui=judge(b,inPut);if (ui==true){System.out.println("中奖");}}public static boolean judge(int[] b, int[] inPut){boolean flage=true;int sum=0;for (int i = 0; i < 6; i++) {if (b[i]==inPut[i]){flage=true;sum++;}}return false;}
}    

二维数组遍历:

public class d1 {public static void main(String[] args) {int[][] a = {{1, 2, 3},{4, 5, 6, 7, 8, 9, 10}};for (int i = 0; i< a.length; i++) {              // 遍历行数(一维数组)for (int j = 0; j < a[i].length; j++) {      // 遍历列数中每个元素(一维数组中的每个元素)System.out.print(a[i][j]+" ");}System.out.println();}}
}1 2 3 
4 5 6 7 8 9 10 
数据类型[][] 数组名=new 数据类型[m][n];        //m表示行 ,n表示列
package ko;public class d1 {public static void main(String[] args) {int[][] a =new int[3][5];a [1][0]=2;a [1][1]=6;a [1][2]=2;a [1][3]=5;a [1][4]=2;for (int i = 0; i < a.length; i++) {for (int j = 0; j < a[i].length; j++) {System.out.print(a[i][j]);}System.out.println();}}
}00000
26252
00000

案例:计算营业额和季度营业额

package ko;import java.util.Scanner;public class d1 {public static void main(String[] args) {int[][] a = new int[4][3];                         // 定义一个4行3列的数组Scanner m = new Scanner(System.in);                // 调用输入方法int allSum = 0;                        // 定义一个全部总和的初始值(全部总和的值必须放在循环的外面)for (int i = 0; i < a.length; i++) {int sum=0;                         // 定义季度总和的初始值(季度总和的值必须放在循环的里面)for (int j = 0; j < a[i].length; j++) {System.out.print("输入数字 : ");int b = m.nextInt();                       // 调用输入的数值a[i][j] = b;sum+=a[i][j];allSum+=a[i][j];}System.out.println();System.out.println("第 " + (i + 1) + " 季度的总和: " + sum);  // 输出当前季度的总和}m.close();System.out.println(allSum);}
}输入数字 : 1
输入数字 : 1
输入数字 : 1第 1 季度的总和: 3
输入数字 : 1
输入数字 : 1
输入数字 : 1第 2 季度的总和: 3
输入数字 : 1
输入数字 : 1
输入数字 : 1第 3 季度的总和: 3
输入数字 : 1
输入数字 : 1
输入数字 : 1第 4 季度的总和: 3
12// 动态定义数组并进行计算

快捷键

CTRL+ALT+L:重置格式

Ctrl+ALT+V:快速创建对象

Ctrl+ALT+M:快速抽取方法(选中要抽取的语句)

Shift+F6:批量修改相同字符

Ctrl+P:查看补齐的变量参数

Ctrl+Alt+T:自动匹配代码块

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

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

相关文章

GO指南之练习答案

GO指南之练习答案 Go指南 练习:循环与函数 为了练习函数与循环,我们来实现一个平方根函数:给定一个数 x,我们需要找到一个数 z 使得 z 尽可能地接近 x。 计算机通常使用循环来计算 x 的平方根。从某个猜测的值 z 开始,我们可以根据 z 与 x 的近似度来改进 z,产生一个更好…

第三轮easy~hard题目

题目1代码 #include<iostream> #include<queue> #include<string> using namespace std; int main() {priority_queue<int> s;string str;int a;str="0";while(str!="end"){cin>>str;if(str=="insert"){cin>&g…

通过Ollama本地部署DeepSeek R1以及简单使用

本文介绍了在Windows环境下,通过Ollama来本地部署DeepSeek R1。该问包含了Ollama的下载、安装、安装目录迁移、大模型存储位置修改、下载DeepSeek以及通过Web UI来对话等相关内容。1、下载Ollama 首先我们到Ollama官网去下载安装包,此处我们下载的是Windows版本的安装包,如下…

git删除gitee上传大文件转载

前言:在提交推送本地更改至仓库时,误将大文件给提交了,导致push时报错文件过大,因此需要将已经commit的大文件移除后再push 若已知要删除的文件或文件夹路径,则可以从第4步开始 1.对仓库进行gc操作 $ git gc 2.查询大文件 git verify-pack -v .git/objects/pack/pack-*.id…

Axure RP 9.0 软件安装、汉化

‌Axure RP9是一款专业的原型设计工具,主要用于快速创建交互式的高保真原型,帮助设计师和产品经理进行用户体验设计和界面设计‌。‌ 主要功能和应用场景‌原型设计‌:Axure RP9提供了丰富的交互组件和功能,如可交互的按钮、链接、表单元素等,用户可以模拟真实的应用程序或…

第八节 BERT实战

做下游分类任务,如何处理一句话的输入input_dis:输入哪些字 21128个汉字里编码 mask:输入的话有多长. 模型输入固定,不够的话用padding补上 Seq_ids:句子编码 segmentBERT输入token embedding 字编码(21128, 768) segment embedding 句子编码(2, 768) position embedding不用给…

linux X64函数参数传递过程研究

linux X64函数参数传递过程研究 - ZhaoKevin - 博客园 基础知识 函数传参存在两种方式,一种是通过栈,一种是通过寄存器。对于x64体系结构,如果函数参数不大于6个时,使用寄存器传参,对于函数参数大于6个的函数,前六个参数使用寄存器传递,后面的使用栈传递。参数传递的规律…

使用systemback封装Ubuntu系统iso镜像

25年小橘祝亲们钱财发发发,好运来来来。小橘初八就已经开工了,不知道家人们是不是也像小橘一样苦哈哈。今天给亲们分享使用systemback封装Ubuntu系统iso镜像。 一、环境部署 1.安装systembackecho "deb [arch=amd64] http://mirrors.bwbot.org/ stable main" > …

免费+数据安全!手把手教你在PC跑DeepSeek-R1大模型,小白也能秒变AI大神!

0 为啥本地部署? 在本地运行 AI 模型具有以下优势:隐私:你的数据保留在你的机器上 — — 不存在共享敏感信息的风险 成本: DeepSeek R1 可免费使用,无需订阅费或使用费 控制:无需外部依赖即可进行微调和实验1 使用Ollama 1.1 下载并运行应用程序 直达官网:1.2 选择你的平…

mkv和ass字幕文件合并

主要使用两种工具:ffmpeg和mkvmerge 操作系统:windows10及以上 ffmpeg下载:https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl-shared.zip mkvmerge下载:https://mkvtoolnix.download/windows/releases/89.0/mkvtoolnix-64-…

【日记】我已经穿越了那层屏障(1903 字)

正文每次节后都知道,能说 “节后再说” 这句话当时有多爽(笑。现在节后有好多好多事情要做——年后再说的事,袭来!昨天是收假之后第一天,开了个会,我没去。结果他们下来都一幅晴天霹雳的样子,我十分诧异。结果一问,基本上全部的人都要轮岗了。我三月份又要跑去业务线,…

洛谷题单指南-线段树的进阶用法-P5445 [APIO2019] 路灯

原题链接:https://www.luogu.com.cn/problem/P5445 题意解读:给定一个长度为n的01串,一共有q个时刻,对于每个时刻,可能有两种操作:1. 把第x个位置取反 2. 查询a ~ b - 1之间的串在过去有多少个时刻都为1。 解题思路: 一、朴素想法 每个时刻对路灯的状态建立线段树,可以…