自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(164)
  • 资源 (1)
  • 收藏
  • 关注

原创 查看windows产品密钥

产品密钥

2022-10-24 15:15:52 1069 2

原创 求阶乘1!+2!+3!+...+N!=

求阶乘1!+2!+3!+...+N!=

2022-10-18 22:11:04 1053

原创 求一个int类型的数在计算机中的32位存储形式

求一个int类型的数在计算机中的32位存储形式

2022-10-18 21:56:17 270

原创 详细讲解java中的多态

1、多态概述同一对象在不同时刻表现不同的形态举例:猫猫 cat=new 猫;(猫是猫)动物 animal=new 猫(猫是动物)猫在不同时刻表现出不同状态就是多态多态的前提和表现:1、有继承和实现关系2、有方法重写3、有父类引用指向子类对象代码实现多态:父类:package animals;public class animal { public void eat(){ System.out.println("动物");

2022-03-22 19:56:53 290

原创 java中的继承

继承是(抽象,封装)是面向对像的三大特征之一,继承可以使子类具有父类的属性和方法,还可以在子类中重新定义、追加属性和方法。继承的格式:public class 子类名 extends 父类名{}public class zi extends fu{}父类被称为基类或者超类子类也被称为派生类下面通过代码创建父类,子类继承父类,测试代码...父类;package extend;public class fu { public void show(){

2022-03-22 17:41:29 1222

原创 什么是API,JAVA 的API

API:应用程序编程接口Java API: JDK中提供各种功能的java类,这些类将底层的实现封装了起来,我们不需要关心这些类是如何实现的,只需要学习如何使用这些类即可,我们可以通过帮助文档来学习这些API如何使用...

2022-03-21 23:07:44 355

原创 if,语句的使用,求一个数的绝对值

A dice game描述One day, boy A and girl B are playing a dice game. First, they write a number between 1~6 in a piece of paper, and then roll the dice. The one whose number is closer to the number of the dice will win this game. For example, A wins if |a

2022-03-21 19:46:32 1858

原创 算法练习题,删除字符序列中重复的元素,只保留一个

Line up in the canteen描述One day, there is a kind of new delicious food from one of the windows in the canteen. All students want to have a taste. Therefore, they all go to this window to line up and form a sequence. We need to simplify this sequence. F

2022-03-20 17:17:52 273

原创 算法题,统计1~n之间,含有某个数字的树共有多少个、计算某个数的位数

1、先来实现计算某个数的位数下面是代码:#include<iostream>using namespace std;int main() { int num = 0; while (cin >> num) { int m = 0; int flag = 1; while (flag) { num = num / 10; m++; if (num == 0) { flag = 0; } } cout <&l

2022-03-20 15:06:42 426

原创 java 求数组中心下标

数组的中心下标:数组的一个下标,其左侧所有元素之和等于右侧元素之和如果不存在中心下标返回-1,如果同时存在多个中心下标,返回最左边的中心下标例如:arr=[1,7,3,6,5,6]算法步骤:用类似双指针的方法,先求出数组所有元素之和,sumfor循环从第一个元素开始,定义一个total(此时索引所在的值加上这个索引左边所有的值)i=0 total=arr[0] sum!=total i++ sum=sum-arr[0]i=1 total=arr[0]+arr[1] sum!=

2022-03-18 22:55:41 1770

原创 双指针算法,删除排序数组中的重复项

要求原地删除重复出现的元素,返回删除后数组的新长度,不能使用额外的数组空间例如数组:arr=[0,1,2,2,3,3,4,]利用双指针算法:定义指针 i (慢指针) j(快指针)第一步:i j分别指向arr[0]和arr[1] 即:i->0; j->1 arr[i]!=arr[j] i++;j++第二步:i j分别指向arr[1]和arr[2] 即:i->1; j->2 arr[i]!=arr[j] i++;j++第三步:i j分别指向arr[2]和arr[3]

2022-03-18 21:46:59 420

原创 java统计小于2~n之间素数的个数

1、暴力算法:package eratosthenes;public class func01 { public static void main(String[] args){ bf(10); } public static int bf(int n){ int count=0; for(int i=2;i<n;i++){ for(int j=2;j<i;j++)

2022-03-18 19:54:50 669

原创 leetcode 之链表反转

例如:输入1->2->3->4->5输出:5->4->3->2->1两种方法:1、迭代 2、递归要注意的一点是我们在将结点“ 1”指向null之前先要定义一个变量来保存下一个元素结点进行(我们通过链表只能获得链表指向的下一个元素),否则我们将无法通过结点“1”找到其他元素这样就完成了对第一个元素的反转这是对第二个元素进行反转的流程图,我们需要将第二个结点指向第一个节点,我们得先设置一个变量“prev”来保存前一个结点...

2022-03-18 17:07:56 1190

原创 Python判断三个数的最大值

num1 = int(input("输入第一个数:"))num2 = int(input("输入第二个数:"))num3 = int(input("输入第三个数:"))max = (num1 if num1 > num2 else num2) if(num1 if num1 > num2 else num2) > num3 else num3print("最大值是:",max)...

2022-03-13 11:07:02 3123

原创 java创建学生类对象,输入学生信息并遍历

学生类代码:package Student_02;public class Student { private String name; private String age; public Student(){} public Student(String name,String age){ this.name=name; this.age=age; } public void setName(String n

2022-03-12 00:03:42 4201

原创 java用ArryList创建一个Student类并遍历所有元素

下面是学生类的创建:public class Student{ //成员变量 private String name; private int age; //无参构造方法 public Student(){} //带参构造方法 public Student(String name,int age){ this.name=name; this.age=age; } //成员方法 //se

2022-03-08 00:46:11 418

原创 java中遍历集合方法

import java.util.ArrayList;public class TravelArray{ public static void main(String[] args) { ArrayList<String> array=new ArrayList<String>(); array.add("li"); array.add("ru"); array.add("ting"); .

2022-03-08 00:11:56 176

原创 java中ArryList的各种使用方法

import java.util.ArrayList;public class arryadd{ public static void main(String[] args){ ArrayList<String> array=new ArrayList<String>(); //System.out.println(array.add("hello")); array.add("hello"); .

2022-03-07 23:55:44 192

原创 java中ArryList使用方法

import java.util.ArrayList;public class arryadd{ public static void main(String[] args){ ArrayList<String> array=new ArrayList<String>(); //System.out.println(array.add("hello")); array.add("hello"); .

2022-03-07 23:49:20 368

原创 java中创建数组

public class Arr{ public static void main(String[] args){ int[] arr=new int[3]; //左边int 是数据类型 [] 说明是数组 arr是数组名 //右边 new 是为数组分配空间 int 说明数组是int类型 []说明是数组 3 说明数组中有3个元素 }}...

2022-02-28 20:22:19 586

原创 java的数据输入

//导包import java.util.Scanner;public class Cin{ public static void main(String[] args){ //创建对象 Scanner number=new Scanner(System.in); //接受数据 int i=number.nextInt(); //输出 System.out.println("输入的数据是:"+i).

2022-02-28 20:08:48 187

原创 java产生随机数方法程序

//导包import java.util.Random;public class RandomNumber{ public static void main(String[] args){ //创建对象 Random r=new Random(); //获取随机数 int number=r.nextInt(10); System.out.println("产生的随机数是"+number); }}..

2022-02-28 19:47:42 145

原创 在运行java程序时中文乱码并报错的解决方法

可以在编译时加一句代码(设定cmd的编码为utf-8):-encoding UTF-8 即可解决问题

2022-02-28 19:15:48 966

原创 用Java写hello world

public class helloworld{ public static void main(String[] args){ System.out.println("hello world"); }}

2022-02-22 16:25:51 974

原创 二分查找C++

#include<iostream>using namespace std;int BinarySearch(int arry[],int target){ int l = 0; int r = sizeof(arry) - 1; while (l <= r) { int mid = (l + r) / 2; if (arry[mid] == target) return mid; else if (arry[mid] < target) l = mid.

2022-01-22 18:26:08 319

原创 八种排序算法

排序算法的稳定性排序算法的世间复杂度简单说就是程序循环执行的总次数,算法的时间复杂度是一个函数,定量的描述了算法运行的时间用符号O表示,即O(f(n));常见八种排序:1、直接排序代码:#include<iostream>using namespace std;void InsertSort(int* a, int length){ int i = 0, j = 0, temp = 0; for (i = 1; i < l...

2021-12-12 00:31:30 1556 4

原创 web制作的小网页

代码css和js部分需要自己创建文件夹加进去图片也需要自己新建自己的images文件夹插入效果图:HTML部分<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />...

2021-12-08 10:31:23 820

原创 web前端制作一个简易的小网页-主页搜索框

附上一张图片代码:<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Index</title> <style> body{ background: url("images/b.jpg"); } .inline-...

2021-12-08 08:53:22 4306

原创 C++的迭代器以及它的用法

迭代器:是一种可以遍历容器元素的数据类型,它是一个变量,相当于容器和操纵容器的算法之间的中介。迭代器可以指向容器中的某个元素,通过迭代器就可以读写它指向的元素。从这一点上看,迭代器和指针类似。迭代器(Iterator)是指针(pointer)的泛化,它允许程序员用相同的方式处理不同的数据结构(容器)。(1)迭代器类似于C语言里面的指针类型,它提供了对对象的间接访问。(2)指针是C语言中的知识点,迭代器是C++中的知识点。指针较灵活,迭代器功能较丰富。(3)迭代器提供一个对容器对象或者strin.

2021-12-05 09:57:30 7614 1

原创 一个程序详细介绍向量vector的使用方法

#include<iostream>#include<vector>#include<algorithm>#include<assert.h>#include<windows.h>//染色using namespace std;//随机创建数组并赋值给向量容器// 生成有n个元素的随机数组,每个元素的随机范围为[rangeL, rangeR] 闭区间void* create(vector<int> &v) {.

2021-12-05 00:10:00 301

原创 创建无向图邻接表

#include <iostream>#include <stdlib.h>using namespace std;typedef struct EdgeNode//边表节点{ int adjvex;//存储该顶点对应的下标 struct EdgeNode* next;//指向该顶点的下一个邻接点}EdgeNode;typedef struct VertexNode//顶点表结点{ char data;//顶点 EdgeN...

2021-12-03 19:39:44 1671

原创 创建无向邻接图

/*邻接表特点:顶点 vi 的出度为第 i 个单链表中的结点个数顶点 vi 的入度为整个单链表中邻接点域值为 i-1 的结点个数逆邻接表特点:顶点 vi 的入度为第 i 个单链表中的结点个数顶点 vi 的出度为整个单链表中邻接点域值为 i-1 的结点的个数*/#include<iostream>using namespace std;#define MAX 25typedef char Vertype;typedef int Edgetype;typedef i.

2021-12-03 18:38:07 240

原创 OJ统计字符出现频度

#include<iostream>using namespace std;int main(){ char c[100]; //输入的字符串 while (cin >> c && c[0] != '0') //输入一段字符串 { int i, b[36] = { 0 }; //存储对应字符的个数 for (i = 0; c[i] != '\0'; .

2021-12-02 11:53:03 193

原创 C++读取文件操作

C++的标准库头文件为:#include<fstream>同时包含了fsteam、ifstream、ofstream下面先简述一下这三者的区别:fstream;且同时具有ofstream和ifstream两种功能,它可以创建文件,向文件写入信息,从文件读取信息。ifstream ;该数据类型表示输入文件流,用于从文件读取信息。ofstream:数据类型表示输出文件流,用于创建文件并向文件写入信息。注意若文件存在,则先清空文件再写入。 ios::in ...

2021-12-01 13:18:55 2999

原创 C++读写文件操作

#include<fstream>#include<iostream>#include<cmath>#include<windows.h>using namespace std;//从键盘上读取字符的函数void read_save() { char c[80] ; ofstream outfile("e://f1.txt");//以输出方式打开文件 if (!outfile) { cerr <&lt.

2021-12-01 09:17:52 536

原创 C++的文件读写操作

#include<cstdio>#include<windows.h>#include<cmath>#define BACKGROUND_BLUE 0x0010 // background color contains blue.void Frequent(char* str){ char ch[100] = { '\0' }; int times[100] = { 0 }; int j, n = 0; for (int i = 0; i &.

2021-12-01 09:15:48 489

原创 OJ测试交换二叉树的左右结点

#include<iostream>#include<stack> #include<queue> #define OK 1#define maxsize 100using namespace std;//定义一棵树的结构体包括根结点、左孩子,右孩子(字符树)typedef struct Tnode { char data; string combine_data; //结点数据域(数值,可大于9),用于树的表达式求值 struct Tnode* .

2021-11-28 22:24:12 74

原创 STL中栈stack 的使用方法

empty() 堆栈为空则返回真pop() 移除栈顶元素 (删除)push() 在栈顶增加元素 (增加)size() 返回栈中元素数目top() 返回栈顶元素,不删除(获取)#include <iostream>#include <stack>using namespace std;int main(){ stack<int> s; //直接入栈 s.push(1); s.push(2); s.push(3); //手动

2021-11-28 00:18:30 728

原创 C++的STL容器中sort()函数的使用方法

#include<iostream>#include<algorithm>//sort()函数所需头文件 using namespace std;int main(){ int a[10] = { 4,5,9,3,8,2,1,4,0,3 };//初始化数组 for (int i = 0; i < 10; i++) cout << a[i]; cout << endl; sort(a, a + 10);//没有第三个.

2021-11-27 22:49:42 857

原创 树的中缀表达式求值

本段代码的功能包括:1、用不同的前序遍历创建二叉树。2、分别用递归或借助栈实现二叉树的前、中、后序遍历。3、二叉树的深度、广度遍历。4、判断一棵树是否是完全二叉树、满二叉树5、用不同方法求所有根结点到树叶的路径、树叶到根结点的路径6、求树的树宽、树深(树高)7、求树的最长路径8、输出所有叶子结点9、计算二叉树零度、一度、二度结点的数量10、将数的中缀表达式转化为后缀表达示,并求解树的中缀表达式C++实现树的前中后序遍历、广度、深度优先遍历、求叶子结点、一度、二度.

2021-11-24 10:51:07 1076

web简易网页制作.zip

web简易网页制作.zip

2021-12-08

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除