根据对数器找规律、根据数据量猜题目解法

题目一

小虎去买苹果,商店只提供两种类型的塑料袋,每种类型都有任意数量。1)能装下6个苹果的袋子2)能装下8个苹果的袋子小虎可以自由使用两种袋子来装苹果,但是小虎有强迫症,他要求自己使用的袋子数量必须最少,且使用的每个袋子必须装满。给定一个正整数N,返回至少使用多少袋子。如果N无法让使用的每个袋子必须装满,返回-1

先想一个暴力解:
1)如果苹果数小于0则直接返回-1
2)先给6号袋定义一个初始值
3)给八号袋装满看最多需要多少个八号袋子
3)然后求余下多少个看能否被6号袋子搞定如果能就得到答案
4)如果不能被6号袋子,则需要八号袋子少一个rest加8个
从而写出如下代码:

	public static int minBags(int apple) {if (apple < 0) {return -1;}int bag8 = (apple >> 3);int rest = apple - (bag8 << 3);while(bag8 >= 0) {// rest 个if(rest % 6 ==0) {return bag8 + (rest / 6);} else {bag8--;rest += 8;}}return -1;}public static void main(String[] args) {for(int apple = 1; apple < 200;apple++) {System.out.println(apple + " : "+ minBags(apple));}}

将如上代码跑一下得到如图控制台输出:

1 : -1
2 : -1
3 : -1
4 : -1
5 : -1
6 : 1
7 : -1
8 : 1
9 : -1
10 : -1
11 : -1
12 : 2
13 : -1
14 : 2
15 : -1
16 : 2
17 : -1
18 : 3
19 : -1
20 : 3
21 : -1
22 : 3
23 : -1
24 : 3
25 : -1
26 : 4
27 : -1
28 : 4
29 : -1
30 : 4
31 : -1
32 : 4
33 : -1
34 : 5
35 : -1
36 : 5
37 : -1
38 : 5
39 : -1
40 : 5
41 : -1
42 : 6
43 : -1
44 : 6
45 : -1
46 : 6
47 : -1
48 : 6
49 : -1
50 : 7
51 : -1
52 : 7
53 : -1
54 : 7
55 : -1
56 : 7
57 : -1
58 : 8
59 : -1
60 : 8
61 : -1
62 : 8
63 : -1
64 : 8
65 : -1
66 : 9
67 : -1
68 : 9
69 : -1
70 : 9
71 : -1
72 : 9
73 : -1
74 : 10
75 : -1
76 : 10
77 : -1
78 : 10
79 : -1
80 : 10
81 : -1
82 : 11
83 : -1
84 : 11
85 : -1
86 : 11
87 : -1
88 : 11
89 : -1
90 : 12
91 : -1
92 : 12
93 : -1
94 : 12
95 : -1
96 : 12
97 : -1
98 : 13
99 : -1
100 : 13
101 : -1
102 : 13
103 : -1
104 : 13
105 : -1
106 : 14
107 : -1
108 : 14
109 : -1
110 : 14
111 : -1
112 : 14
113 : -1
114 : 15
115 : -1
116 : 15
117 : -1
118 : 15
119 : -1
120 : 15
121 : -1
122 : 16
123 : -1
124 : 16
125 : -1
126 : 16
127 : -1
128 : 16
129 : -1
130 : 17
131 : -1
132 : 17
133 : -1
134 : 17
135 : -1
136 : 17
137 : -1
138 : 18
139 : -1
140 : 18
141 : -1
142 : 18
143 : -1
144 : 18
145 : -1
146 : 19
147 : -1
148 : 19
149 : -1
150 : 19
151 : -1
152 : 19
153 : -1
154 : 20
155 : -1
156 : 20
157 : -1
158 : 20
159 : -1
160 : 20
161 : -1
162 : 21
163 : -1
164 : 21
165 : -1
166 : 21
167 : -1
168 : 21
169 : -1
170 : 22
171 : -1
172 : 22
173 : -1
174 : 22
175 : -1
176 : 22
177 : -1
178 : 23
179 : -1
180 : 23
181 : -1
182 : 23
183 : -1
184 : 23
185 : -1
186 : 24
187 : -1
188 : 24
189 : -1
190 : 24
191 : -1
192 : 24
193 : -1
194 : 25
195 : -1
196 : 25
197 : -1
198 : 25
199 : -1Process finished with exit code 0

发现从18-25偶数返回3,奇数返回-1
从26-33,偶数返回4,奇数返回-1
从34-41 偶数返回5,奇数返回-1
假设
18-25是第0组 -> 0+3
26-33是第1组- > 1+3
依次类推最终可得如下代码:

O(1)的时间复杂度解决

	public static int minBagAwesome(int apple) {if ((apple & 1) != 0) { // 如果是奇数,返回-1return -1;}if (apple < 18) {return apple == 0 ? 0 : (apple == 6 || apple == 8) ? 1: (apple == 12 || apple == 14 || apple == 16) ? 2 : -1;}return (apple - 18) / 8 + 3;}

题目二

给定一个正整数N,表示有N份青草统一堆放在仓库里有一只牛和一只羊,牛先吃,羊后吃,它俩轮流吃草不管是牛还是羊,每一轮能吃的草量必须是:1,4,16,64…(4的某次方)谁最先把草吃完,谁获胜假设牛和羊都绝顶聪明,都想赢,都会做出理性的决定根据唯一的参数N,返回谁会赢
这道题在博弈论的视角下是无选择的,先手一定会考虑一定能赢的情况,后手也不会失误

在这里插入图片描述
前四分份草的结果。

可以写如下代码:

	// 如果n份草,最终先手赢,返回"先手"// 如果n份草,最终后手赢,返回"后手"public static String whoWin(int n) {//先写hardCodeif (n < 5) {//0或2的时候后手赢return n == 0 || n == 2 ? "后手" : "先手";}// 进到这个过程里来,当前的先手,先选(和全局的先手无关)int want = 1;while (want <= n) {//如果后续的过程种,当前这个过程的先手赢了if (whoWin(n - want).equals("后手")) {return "先手";}//防止want溢出,如果want小于等于n/4那么want乘以4一定安全if (want <= (n / 4)) {want *= 4;} else {break;}}return "后手";}public static void main(String[] args) {for (int i = 0; i <= 50; i++) {System.out.println(i + " : " + whoWin(i));}}

发现按照后先后先先的规律出现

0 : 后手
1 : 先手
2 : 后手
3 : 先手
4 : 先手
5 : 后手
6 : 先手
7 : 后手
8 : 先手
9 : 先手
10 : 后手
11 : 先手
12 : 后手
13 : 先手
14 : 先手
15 : 后手
16 : 先手
17 : 后手
18 : 先手
19 : 先手
20 : 后手
21 : 先手
22 : 后手
23 : 先手
24 : 先手
25 : 后手
26 : 先手
27 : 后手
28 : 先手
29 : 先手
30 : 后手
31 : 先手
32 : 后手
33 : 先手
34 : 先手
35 : 后手
36 : 先手
37 : 后手
38 : 先手
39 : 先手
40 : 后手
41 : 先手
42 : 后手
43 : 先手
44 : 先手
45 : 后手
46 : 先手
47 : 后手
48 : 先手
49 : 先手
50 : 后手Process finished with exit code 0

根据上面得出的结论可以推导出如下代码:

public static String winner2(int n) {if (n % 5 == 0 || n % 5 == 2) {return "后手";} else {return "先手";}}

题目三

定义一种数:可以表示成若干(数量>1)连续正数和的数 比如: 5 = 2+3,5就是这样的数 12 = 3+4+5,12就是这样的数 1不是这样的数,因为要求数量大于1个、连续正数和 2 = 1 + 1,2也不是,因为等号右边不是连续正数 给定一个参数N,返回是不是可以表示成若干连续正数和的数

暴力:
一个n看能否被1开头的连续数搞出来
1个n看能否被2开头的连续数搞出来
依次递推。

写出如下代码:

public static boolean isMSum1(int num) {//从某个数开始一直加加到某一个数小于num,某一个数的下一个数加上大于num//则表示以当前数开始的连续和不能组成numfor (int start = 1; start <= num; start++) {int sum = start;for (int j = start + 1; j <= num; j++) {if (sum + j > num) {break;}if (sum + j == num) {return true;}sum += j;}}return false;}public static void main(String[] args) {for (int num = 1; num < 200; num++) {System.out.println(num + " : " + isMSum1(num));}}

得到:

1 : false
2 : false
3 : true
4 : false
5 : true
6 : true
7 : true
8 : false
9 : true
10 : true
11 : true
12 : true
13 : true
14 : true
15 : true
16 : false
17 : true
18 : true
19 : true
20 : true
21 : true
22 : true
23 : true
24 : true
25 : true
26 : true
27 : true
28 : true
29 : true
30 : true
31 : true
32 : false
33 : true
34 : true
35 : true
36 : true
37 : true
38 : true
39 : true
40 : true
41 : true
42 : true
43 : true
44 : true
45 : true
46 : true
47 : true
48 : true
49 : true
50 : true
51 : true
52 : true
53 : true
54 : true
55 : true
56 : true
57 : true
58 : true
59 : true
60 : true
61 : true
62 : true
63 : true
64 : false
65 : true
66 : true
67 : true
68 : true
69 : true
70 : true
71 : true
72 : true
73 : true
74 : true
75 : true
76 : true
77 : true
78 : true
79 : true
80 : true
81 : true
82 : true
83 : true
84 : true
85 : true
86 : true
87 : true
88 : true
89 : true
90 : true
91 : true
92 : true
93 : true
94 : true
95 : true
96 : true
97 : true
98 : true
99 : true
100 : true
101 : true
102 : true
103 : true
104 : true
105 : true
106 : true
107 : true
108 : true
109 : true
110 : true
111 : true
112 : true
113 : true
114 : true
115 : true
116 : true
117 : true
118 : true
119 : true
120 : true
121 : true
122 : true
123 : true
124 : true
125 : true
126 : true
127 : true
128 : false
129 : true
130 : true
131 : true
132 : true
133 : true
134 : true
135 : true
136 : true
137 : true
138 : true
139 : true
140 : true
141 : true
142 : true
143 : true
144 : true
145 : true
146 : true
147 : true
148 : true
149 : true
150 : true
151 : true
152 : true
153 : true
154 : true
155 : true
156 : true
157 : true
158 : true
159 : true
160 : true
161 : true
162 : true
163 : true
164 : true
165 : true
166 : true
167 : true
168 : true
169 : true
170 : true
171 : true
172 : true
173 : true
174 : true
175 : true
176 : true
177 : true
178 : true
179 : true
180 : true
181 : true
182 : true
183 : true
184 : true
185 : true
186 : true
187 : true
188 : true
189 : true
190 : true
191 : true
192 : true
193 : true
194 : true
195 : true
196 : true
197 : true
198 : true
199 : true

发现只要是2的某次方那么这个数就返回false,那么只需要判断某个数的二进制是否只有一个1即可,将某个数的最右侧的1取出来和它自己比较如果相等则是2的n次方
num&(~num+1)

	public static boolean isMSum2(int num) {//		return num == (num & (~num + 1));
//
//		return num == (num & (-num));return (num & (num - 1)) != 0;}public static void main(String[] args) {for (int num = 1; num < 200; num++) {System.out.println(num + " : " + isMSum1(num));}System.out.println("test begin");for (int num = 1; num < 5000; num++) {if (isMSum1(num) != isMSum2(num)) {System.out.println("Oops!");}}System.out.println("test end");}

总结

1)某个面试题,输入参数类型简单,并且只有一个实际参数2)要求的返回值类型也简单,并且只有一个
3)用暴力方法,把输入参数对应的返回值,打印出来看看,进而优化code

根据数据规模猜解法

1)C/C++,1秒处理的指令条数为10的8次方
2)Java等语言,1~4秒处理的指令条数为10的8次方、
3)这里就有大量的空间了!

题目五

int[] d,d[i]:i号怪兽的能力 int[]
p,p[i]:i号怪兽要求的钱
开始时你的能力是0,你的目标是从0号怪兽开始,通过所有的怪兽。 如果你当前的能力,小于i号怪兽的能力,你必须付出p[i]的钱,贿赂这个怪兽,然后怪兽就会加入你,他的能力直接累加到你的能力上;如果你当前的能力,大于等于i号怪兽的能力,你可以选择直接通过,你的能力并不会下降,你也可以选择贿赂这个怪兽,然后怪兽就会加入你,他的能力直接累加到你的能力上。 返回通过所有的怪兽,需要花的最小钱数。

递归解法:

	// int[] d d[i]:i号怪兽的武力// int[] p p[i]:i号怪兽要求的钱// ability 当前你所具有的能力// index 来到了第index个怪兽的面前// 目前,你的能力是ability,你来到了index号怪兽的面前,如果要通过后续所有的怪兽,// 请返回需要花的最少钱数public static long process1(int[] d, int[] p, int ability, int index) {if (index == d.length) {return 0;}//必须要花钱的情况if (ability < d[index]) {//记录花的钱										当前能力加怪兽的能力,去打后面的怪兽return p[index] + process1(d, p, ability + d[index], index + 1);} else { // ability >= d[index] 可以贿赂,也可以不贿赂return Math.min(//花钱p[index] + process1(d, p, ability + d[index], index + 1),
//不花钱0 + process1(d, p, ability, index + 1));}}public static long func1(int[] d, int[] p) {return process1(d, p, 0, 0);}

第二种解法:
先定义一张表i表示第i号怪兽,j表示所要花的钱数,从0号怪兽到i号怪兽我花的钱为多少的时候我的能力最大,并且要严格花费j元,如果没有严格花j元则为-1,并且我在0-i-1的位置上已花费了j元,那么我通过i-1位置对应的能力一定要大于i号怪兽的能力。
如dp[100][130],表示我想从0号怪兽通关到100号怪兽严格花费130元,假设100号怪兽能力是50,贿赂它的钱是30。
第一种情况:不想贿赂100号怪兽一定是0-99号怪兽贿赂花了130,如果dp[99][130] = -1,则dp[100][130]也是-1,如果dp[99][130]=80则可以直接通过的得到dp[100][130]为80的能力。
第二种情况:贿赂100号怪兽,假设当前怪兽能力为x,花的是y
要整体凑出j元
那么dp[i-1][j-y] 不等于 -1

	// 从0....index号怪兽,花的钱,必须严格==money// 如果通过不了,返回-1// 如果可以通过,返回能通过情况下的最大能力值public static long process2(int[] d, int[] p, int index, int money) {if (index == -1) { // 一个怪兽也没遇到呢return money == 0 ? 0 : -1;}// index >= 0// 1) 不贿赂当前index号怪兽long preMaxAbility = process2(d, p, index - 1, money);long p1 = -1;//如果之前的能力不为-1并且之前的能力大于等于当前的能力则记录一个p1if (preMaxAbility != -1 && preMaxAbility >= d[index]) {p1 = preMaxAbility;}// 2) 贿赂当前的怪兽 当前的钱 p[index]long preMaxAbility2 = process2(d, p, index - 1, money - p[index]);long p2 = -1;if (preMaxAbility2 != -1) {p2 = d[index] + preMaxAbility2;}return Math.max(p1, p2);}public static int minMoney2(int[] d, int[] p) {int allMoney = 0;for (int i = 0; i < p.length; i++) {allMoney += p[i];}int N = d.length;for (int money = 0; money < allMoney; money++) {if (process2(d, p, N - 1, money) != -1) {return money;}}return allMoney;}public static long func3(int[] d, int[] p) {int sum = 0;for (int num : p) {sum += num;}// dp[i][j]含义:// 能经过0~i的怪兽,且花钱为j(花钱的严格等于j)时的武力值最大是多少?// 如果dp[i][j]==-1,表示经过0~i的怪兽,花钱为j是无法通过的,或者之前的钱怎么组合也得不到正好为j的钱数int[][] dp = new int[d.length][sum + 1];for (int i = 0; i < dp.length; i++) {for (int j = 0; j <= sum; j++) {dp[i][j] = -1;}}// 经过0~i的怪兽,花钱数一定为p[0],达到武力值d[0]的地步。其他第0行的状态一律是无效的dp[0][p[0]] = d[0];for (int i = 1; i < d.length; i++) {for (int j = 0; j <= sum; j++) {// 可能性一,为当前怪兽花钱// 存在条件:// j - p[i]要不越界,并且在钱数为j - p[i]时,要能通过0~i-1的怪兽,并且钱数组合是有效的。if (j >= p[i] && dp[i - 1][j - p[i]] != -1) {dp[i][j] = dp[i - 1][j - p[i]] + d[i];}// 可能性二,不为当前怪兽花钱// 存在条件:// 0~i-1怪兽在花钱为j的情况下,能保证通过当前i位置的怪兽if (dp[i - 1][j] >= d[i]) {// 两种可能性中,选武力值最大的dp[i][j] = Math.max(dp[i][j], dp[i - 1][j]);}}}int ans = 0;// dp表最后一行上,dp[N-1][j]代表:// 能经过0~N-1的怪兽,且花钱为j(花钱的严格等于j)时的武力值最大是多少?// 那么最后一行上,最左侧的不为-1的列数(j),就是答案for (int j = 0; j <= sum; j++) {if (dp[d.length - 1][j] != -1) {ans = j;break;}}return ans;}

先定义1张表
dpp[i][j] 从0号怪兽通关到第i号怪兽我的能力要大于等于j至少要花多少钱
在这里插入图片描述

public static long func2(int[] d, int[] p) {int sum = 0;for (int num : d) {sum += num;}long[][] dp = new long[d.length + 1][sum + 1];for (int i = 0; i <= sum; i++) {dp[0][i] = 0;}for (int cur = d.length - 1; cur >= 0; cur--) {for (int hp = 0; hp <= sum; hp++) {// 如果这种情况发生,那么这个hp必然是递归过程中不会出现的状态// 既然动态规划是尝试过程的优化,尝试过程碰不到的状态,不必计算if (hp + d[cur] > sum) {continue;}if (hp < d[cur]) {dp[cur][hp] = p[cur] + dp[cur + 1][hp + d[cur]];} else {dp[cur][hp] = Math.min(p[cur] + dp[cur + 1][hp + d[cur]], dp[cur + 1][hp]);}}}return dp[0][0];}

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

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

相关文章

python门户网站文件爬取并显示

广西南宁政府门面网站 import requests import os import io import numpy as np from concurrent.futures import ThreadPoolExecutor from bs4 import BeautifulSoup import time import pdfplumber import pandas as pd from docx import Document import docx import win32…

WordCount 源码解析 Mapper,Reducer,Driver

创建包 com.nefu.mapreduce.wordcount &#xff0c;开始编写 Mapper &#xff0c; Reducer &#xff0c; Driver 用户编写的程序分成三个部分&#xff1a; Mapper 、 Reducer 和 Driver 。 &#xff08; 1 &#xff09; Mapper 阶段 ➢ 用户自定义的 Mapper 要继承自己的父…

文件服务器搭建

文件服务器搭建 文件服务器有四个选择&#xff1a; httpd&#xff08;apache&#xff09; 稳定&#xff0c;使用广泛&#xff0c;服务器一般自带&#xff0c;对于开发人员来说强烈推荐。 nginx 稳定高效&#xff0c;使用广泛&#xff0c;linux命令可直接下载&#xff0c;对…

STM32CubeIDE串口空闲中断实现不定长数据接收

STM32F051空闲中断实现串口不定长数据接收 目的编程软件配置串口开中断中断程序运行结果目的 在串口输入不定长数据时,通过串口空闲中断来断帧接收数据。 编程软件 STM32CubeIDE STM32CubeMX配置MCU。通过对端口配置,自动生成程序,减少编程量。 配置串口开中断 配置串口…

redis中序列化问题,value包含全路径类名解析

1. 问题 redis中保存的key-value格式 value直接存入的是实体对象&#xff0c;值中包含全路径类名&#xff0c;在使用Jackson2JsonRedisSerializer和GenericJackson2JsonRedisSerializer解析器时报错 报错内容&#xff1a; com.fasterxml.jackson.databind.exc.InvalidTypeI…

《师兄啊师兄》第二季确认定档!海神扬名,稳健回归!

近日&#xff0c;《师兄啊师兄》第二季的定档海报和PV终于发布&#xff0c;确认将于12月14日上午10点强势回归&#xff01;这部备受瞩目的国漫作品自第一季播出以来&#xff0c;便以其独特的剧情设定和唯美的画风&#xff0c;赢得了广大观众的喜爱。如今&#xff0c;动画第二季…

第一课【习题】给应用添加通知和提醒

构造进度条模板通知&#xff0c;name字段当前需要固定配置为downloadTemplate。 给通知设置分发时间&#xff0c;需要设置showDeliveryTime为false。 OpenHarmony提供后台代理提醒功能&#xff0c;在应用退居后台或退出后&#xff0c;计时和提醒通知功能被系统后台代理接管…

Qt 5.15.2 三维显示功能

Qt 5.15.2 三维显示功能 三维显示效果&#xff1a; .pro项目文件 QT core gui opengl 3dcore 3drender 3dinput 3dextrasgreaterThan(QT_MAJOR_VERSION, 4): QT widgetsCONFIG c17# You can make your code fail to compile if it uses deprecated APIs. # In ord…

2023年法国经销商Solu-Watt来访安科瑞-安科瑞 蒋静

2023年4月10日上午9点&#xff0c;法国Solu-Watt公司Matthieu先生一行到安科瑞考察参观工厂的智能化出入库工作站、柔性化仪表生产车间及实验室。自1992年以来&#xff0c;Solu-Watt在电气设备市场中不断发展。能够提供量身定制的安装有线电气解决方案&#xff08;电气柜、接线…

如何用Qt配置git项目并上传Gitee

1.进入到Qt项目文件夹内&#xff0c;打开 “Git Bash Here” 2.初始化&#xff0c;在“Git Bash Here”中输入 git init 3.加入所有文件&#xff0c;在“Git Bash Here”中输入 git add . (需要注意&#xff0c;git add 后面还有一个点) 4.添加备注&#xff0c;git com…

STL源码剖析笔记——哈希表、unordered_set、unordered_map、unordered_mutiset、unordered_mutimap

系列文章目录 STL源码剖析笔记——迭代器 STL源码剖析笔记——vector STL源码剖析笔记——list STL源码剖析笔记——deque、stack&#xff0c;queue STL源码剖析笔记——Binary Heap、priority_queue STL源码剖析笔记——AVL-tree、RB-tree、set、map、mutiset、mutimap STL源…

一套rk3588 rtsp服务器推流的 github 方案及记录 -01

我不生产代码&#xff0c;我只是代码的搬运工&#xff0c;相信我&#xff0c;看完这个文章你的图片一定能变成流媒体推出去。 诉求&#xff1a;使用opencv拉流&#xff0c;转成bgr数据&#xff0c;需要把处理后的数据&#xff08;BGR&#xff09;编码成264&#xff0c;然后推流…

字符串函数strtok

1.调用格式&#xff1a; 2.调用形式&#xff1a;char*strtok(char*p1,const char*p2),其中第二个是由分隔符组成的字符串&#xff0c;第一个为需要分隔的字符串 3.调用目的&#xff1a;将分隔符之间的字符串取出 4.调用时一般将源字符串拷贝后调用&#xff0c;因为此函数会将…

基于Unity3D 低多边形地形模型纹理贴图

在线工具推荐&#xff1a; 3D数字孪生场景编辑器 - GLTF/GLB材质纹理编辑器 - 3D模型在线转换 - Three.js AI自动纹理开发包 - YOLO 虚幻合成数据生成器 - 三维模型预览图生成器 - 3D模型语义搜索引擎 当谈到游戏角色的3D模型风格时&#xff0c;有几种不同的风格&#xf…

【工程实践】使用modelscope下载大模型文件

前言 Modelscope&#xff08;魔搭社区&#xff09;是阿里达摩院的一款开源模型平台&#xff0c;里面提供了很多的热门模型供使用体验&#xff0c;其中的模型文件可以通过git clone 快速下载。并且为模型提供了Notebook的快速开发体验&#xff0c;使用阿里云服务&#xff0c;不需…

【优选算法系列】【专题二滑动窗口】第三节.904. 水果成篮和438. 找到字符串中所有字母异位词

文章目录 前言一、水果成篮 1.1 题目描述 1.2 题目解析 1.2.1 算法原理 1.2.2 代码编写 1.2.3 题目总结二、找到字符串中所有字母异位词 2.1 题目描述 2.2 题目解析 2.2.1 算法原理 2.2.2 代码编写 …

SAP UI5 walkthrough step9 Component Configuration

在之前的章节中&#xff0c;我们已经介绍完了MVC的架构和实现&#xff0c;现在我们来讲一下&#xff0c;SAPUI5的结构 这一步&#xff0c;我们将所有的UI资产从index.html里面独立封装在一个组件里面 这样组件就变得独立&#xff0c;可复用了。这样&#xff0c;无所什么时候我…

队列的实现

学习就像一段长跑&#xff0c;比的不是谁跑得快&#xff0c;而是谁更能坚持&#xff01;&#xff01; 1 队列的概念及结构 队列&#xff1a;只允许在一端进行插入数据操作&#xff0c;在另一端进行删除数据操作的特殊线性表&#xff0c;队列具有先进先出 FIFO(First In First O…

外网访问内网服务器使用教程

如何在任何地方都能访问自己家里的笔记本上的应用&#xff1f;如何让局域网的服务器可以被任何地方访问到&#xff1f;有很多类似的需求&#xff0c;我们可以统一用一个解决方案&#xff1a;内网穿透。内网穿透的工具及方式有很多&#xff0c;如Ngrok、Ssh、autossh、Natapp、F…

linux具体命令(一)

1. cd CD命令是Linux和类Unix操作系统中非常常用的一个命令&#xff0c;它的全称是“change directory”&#xff0c;用于改变当前的工作目录。用户可以通过这个命令进入到不同的目录中&#xff0c;进行文件操作或是执行其他任务。 以下是CD命令的一些基本用法&#xff1a; 进…