ICPC训练联盟暑期线上集训(递归与回溯)

  • A POJ 1664 放苹果
  • 题解
  • B POJ 2013 Symmetric Order
  • 题解
  • C POJ 3889 Fractal Streets
  • D POJ 2083 Fractal
  • 题解
  • E POJ 1979 Red and Black
  • 题解
  • F UVA 167 The Sultan's Successors
  • 题解
  • G POJ 2258 The Settlers of Catan
  • 题解
  • H POJ 1040 Transportation
  • I POJ 1315 Don't Get Rooked
  • J UVA 750 8 Queens Chess Problem

A POJ 1664 放苹果

传送门: link.
Description

把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。

Input

第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。

Output

对输入的每组数据M和N,用一行输出相应的K。

Sample Input

1
7 3

Sample Output

8

题解

递归,有以下几种情况:
当m = 1,f(1,n) = 1;将一个苹果放在n个盘子里,只有一种放法;

当n = 1,f(m,1) = 1;将m个苹果放在1个盘子里,只有一种方法;

当m = n,f(m,n) = f(m,n-1)+1;每个盘子里都放苹果,或者至少有一个盘子里不放苹果;

当m < n, f(m,n) = f(m,m);只能把m个苹果放进m个盘子里;

当m > n,f(m,n) = f(m,n-1)+f(m-n,n);每个盘子里都放苹果,先把n个苹果抽出来放进n个盘子里,剩下m-n个苹果放进n个盘子里;或者至少一个盘子里不放。

#include<stdio.h>
int fun(int m,int n)
{if(m==0||n==1)return 1;if(m<n)return fun(m,m);elsereturn fun(m,n-1)+fun(m-n,n);
}
int main()
{int t,m,n;scanf("%d",&t);while(t--){scanf("%d%d",&m,&n);printf("%d\n",fun(m,n));}return 0;
}

B POJ 2013 Symmetric Order

传送门: link.
Description

In your job at Albatross Circus Management (yes, it’s run by a bunch of clowns), you have just finished writing a program whose output is a list of names in nondescending order by length (so that each name is at least as long as the one preceding it). However, your boss does not like the way the output looks, and instead wants the output to appear more symmetric, with the shorter strings at the top and bottom and the longer strings in the middle. His rule is that each pair of names belongs on opposite ends of the list, and the first name in the pair is always in the top part of the list. In the first example set below, Bo and Pat are the first pair, Jean and Kevin the second pair, etc.

Input

The input consists of one or more sets of strings, followed by a final line containing only the value 0. Each set starts with a line containing an integer, n, which is the number of strings in the set, followed by n strings, one per line, sorted in nondescending order by length. None of the strings contain spaces. There is at least one and no more than 15 strings per set. Each string is at most 25 characters long.

Output

For each input set print “SET n” on a line, where n starts at 1,
followed by the output set as shown in the sample output.

Sample Input

7
Bo
Pat
Jean
Kevin
Claude
William
Marybeth
6
Jim
Ben
Zoe
Joey
Frederick
Annabelle
5
John
Bill
Fran
Stan
Cece
0

Sample Output

SET 1
Bo
Jean
Claude
Marybeth
William
Kevin
Pat
SET 2
Jim
Zoe
Frederick
Annabelle
Joey
Ben
SET 3
John
Fran
Cece
Stan
Bill

题解

递归实现

#include<iostream>
using namespace std;
void fun(int n)
{string s;cin>>s;cout<<s<<endl;if(--n){cin>>s;if(--n)fun(n);cout<<s<< endl;}
}
int main()
{int n,cas=1;while(cin>>n&&n){cout<<"SET "<<cas++<<endl;fun(n);}return 0;
}

不用递归的方法

#include<stdio.h>
int main()
{char str[100][100];int n,i,head,tail,cas=1;while(~scanf("%d",&n)&&n){head=0;tail=n-1;for(i=0; i<n; i++){if(i%2==0)scanf("%s",str[head++]);elsescanf("%s",str[tail--]);}printf("SET %d\n",cas++);for(i=0; i<n; i++)printf("%s\n",str[i]);}return 0;
}

C POJ 3889 Fractal Streets

传送门: link.
Description

With a growing desire for modernization in our increasingly larger cities comes a need for new street designs. Chris is one of the unfortunate city planners responsible for these designs. Each year the demands keep increasing, and this year he has even been asked to design a completely new city.
More work is not something Chris needs right now, since like any good bureaucrat, he is extremely lazy. Given that this is a character trait he has in common with most computer scientists it should come as no surprise that one of his closest friends, Paul, is in fact a computer scientist. And it was Paul who suggested the brilliant idea that has made Chris a hero among his peers: Fractal Streets! By using a Hilbert curve, he can easily fill in rectangular plots of arbitrary size with very little work.
A Hilbert curve of order 1 consists of one “cup”. In a Hilbert curve of order 2 that cup is replaced by four smaller but identical cups and three connecting roads. In a Hilbert curve of order 3 those four cups are in turn replaced by four identical but still smaller cups and three connecting roads, etc. At each corner of a cup a driveway (with mailbox) is placed for a house, with a simple successive numbering. The house in the top left corner has number 1, and the distance between two adjacent houses is 10m.
The situation is shown graphically in figure 2. As you can see the Fractal Streets concept successfully eliminates the need for boring street grids, while still requiring very little effort from our bureaucrats.
在这里插入图片描述>As a token of their gratitude, several mayors have offered Chris a house in one of the many new neighborhoods built with his own new scheme. Chris would now like to know which of these offerings will get him a house closest to the local city planning office (of course each of these new neighborhoods has one). Luckily he will not have to actually drive along the street, because his new company “car” is one of those new flying cars. This high-tech vehicle allows him to travel in a straight line from his driveway to the driveway of his new office. Can you write a program to determine the distance he will have to fly for each offier (excluding the vertical distance at takeoff and landing)?

Input

On the first line of the input is a positive integer, the number of test cases. Then for each test case:
A line containing a three positive integers, n < 16 and h, o < 231, specifying the order of the Hilbert curve, and the house numbers of the offered house and the local city planning office.

Output

For each test case:
One line containing the distance Chris will have to fly to his work in meters, rounded to the nearest integer.

Sample Input

3
1 1 2
2 16 1
3 4 33

Sample Output

10
30
50

D POJ 2083 Fractal

传送门: link.
Description

A fractal is an object or quantity that displays self-similarity, in a somewhat technical sense, on all scales. The object need not exhibit exactly the same structure at all scales, but the same “type” of structures must appear on all scales.
A box fractal is defined as below :
A box fractal of degree 1 is simply
X
A box fractal of degree 2 is
X X
X
X X
If using B(n - 1) to represent the box fractal of degree n - 1, then a box fractal of degree n is defined recursively as following
B(n - 1) B(n - 1)
B(n - 1)
B(n - 1) B(n - 1)
Your task is to draw a box fractal of degree n.

Input

The input consists of several test cases. Each line of the input contains a positive integer n which is no greater than 7. The last line of input is a negative integer −1 indicating the end of input.

Output

For each test case, output the box fractal using the ‘X’ notation. Please notice that ‘X’ is an uppercase letter. Print a line with only a single dash after each test case.

Sample Input

1
2
3
4
-1

Sample Output

在这里插入图片描述

题解

递归画图。

#include<stdio.h>
#include<math.h>
#include<string.h>
char a[2500][2500];
int N,i,j,len,n,m;
void dfs(int x,int y,int cur)
{if(cur==1){a[x][y]='X';return;}dfs(x,y,cur-1);//左上角m=x;n=y+pow(3,cur-2)*2;dfs(m,n,cur-1);//右上角m=x+pow(3,cur-2)*2;n=y;dfs(m,n,cur-1);//左下角m=x+pow(3,cur-2)*2;n=y+pow(3,cur-2)*2;dfs(m,n,cur-1);//右下角m=x+pow(3,cur-2);n=y+pow(3,cur-2);dfs(m,n,cur-1);//中间
}
int main()
{while(~scanf("%d",&N)){if(N==-1)break;len=pow(3,N-1);for(i=0; i<len; i++){for(j=0; j<len; j++)a[i][j]=' ';a[i][len]='\0';}dfs(0,0,N);for(i=0; i<len; i++){printf("%s\n",a[i]);}printf("-\n");}return 0;
}

E POJ 1979 Red and Black

传送门: link.
Description

There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can’t move on red tiles, he can move only on black tiles.
Write a program to count the number of black tiles which he can reach by repeating the moves described above.

Input

The input consists of multiple data sets. A data set starts with a line containing two positive integers W and H; W and H are the numbers of tiles in the x- and y- directions, respectively. W and H are not more than 20.
There are H more lines in the data set, each of which includes W characters. Each character represents the color of a tile as follows.
‘.’ - a black tile
‘#’ - a red tile
‘@’ - a man on a black tile(appears exactly once in a data set)
The end of the input is indicated by a line consisting of two zeros.

Output

For each data set, your program should output a line which contains the number of tiles he can reach from the initial tile (including itself).

Sample Input

6 9
…#.
…#





#@…#
.#…#.
11 9
.#…
.#.#######.
.#.#…#.
.#.#.###.#.
.#.#…@#.#.
.#.#####.#.
.#…#.
.#########.

11 6
…#…#…#…
…#…#…#…
…#…#…###
…#…#…#@.
…#…#…#…
…#…#…#…
7 7
…#.#…
…#.#…
###.###
…@…
###.###
…#.#…
…#.#…
0 0

Sample Output

45
59
6
13

题解

求一个人可以走的最多黑色块数,先找到这个人的位置,然后从上下左右四个方向走,#符号相当于墙,无法走。题目可以转换为求连通块的最多个数。

#include<stdio.h>
#include<string.h>
char s[50][50];
int n,m;
int dfs(int x,int y)
{if(x<0||x>n-1||y<0||y>m-1)return 0;if(s[x][y]=='#'){return 0;}else{s[x][y]='#';return 1+dfs(x+1,y)+dfs(x-1,y)+dfs(x,y+1)+dfs(x,y-1);}
}
int main()
{int i,j,sum;while(~scanf("%d%d",&m,&n)){if(m==0&&n==0)break;for(i=0; i<n; i++){scanf("%s",s[i]);}sum=0;for(i=0; i<n; i++){for(j=0; j<m; j++){if(s[i][j]=='@'){sum=dfs(i,j);}}}printf("%d\n",sum);}return 0;
}

F UVA 167 The Sultan’s Successors

传送门: link.

The Sultan of Nubia has no children, so she has decided that the country will be split into up to k
separate parts on her death and each part will be inherited by whoever performs best at some test. It
is possible for any individual to inherit more than one or indeed all of the portions. To ensure that
only highly intelligent people eventually become her successors, the Sultan has devised an ingenious
test. In a large hall filled with the splash of fountains and the delicate scent of incense have been
placed k chessboards. Each chessboard has numbers in the range 1 to 99 written on each square and is
supplied with 8 jewelled chess queens. The task facing each potential successor is to place the 8 queens
on the chess board in such a way that no queen threatens another one, and so that the numbers on
the squares thus selected sum to a number at least as high as one already chosen by the Sultan. (For
those unfamiliar with the rules of chess, this implies that each row and column of the board contains
exactly one queen, and each diagonal contains no more than one.)
Write a program that will read in the number and details of the chessboards and determine the
highest scores possible for each board under these conditions. (You know that the Sultan is both a
good chess player and a good mathematician and you suspect that her score is the best attainable.)

Input

Input will consist of k (the number of boards), on a line by itself, followed by k sets of 64 numbers,
each set consisting of eight lines of eight numbers. Each number will be a positive integer less than100. There will never be more than 20 boards.

Output

Output will consist of k numbers consisting of your k scores, each score on a line by itself and right
justified in a field 5 characters wide.

Sample Input

1
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
48 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64

Sample Output

260

题解

全排列问题,标记皇后位置, 每次判断vis【0】【i】第i列 和vis【1】【i+cnt】 副对角线上和vis【2】【i-cnt+8】 主对角线上是否存在皇后。

#include<stdio.h>
#include<string.h>
int map[10][10];
int v[3][40];
int n,i,j,k,max;
void dfs(int cnt, int sum)
{if(cnt>=8){if(max<sum)max=sum;}else{for(int i=0; i<8; i++){if(!v[0][i]&&!v[1][i+cnt]&&!v[2][i-cnt+8]){v[0][i] = v[1][i+cnt] = v[2][i-cnt+8]=1;dfs(cnt+1, sum+map[cnt][i]);v[0][i] = v[1][i+cnt] = v[2][i-cnt+8]=0;}}}
}
int main()
{scanf("%d",&n);while(n--){memset(map, 0, sizeof(map));memset(v, 0, sizeof(v));max=0;for(i=0; i<8; i++)for(j=0; j<8; j++)scanf("%d",&map[i][j]);dfs(0,0);printf("%5d\n",max);}return 0;
}

G POJ 2258 The Settlers of Catan

传送门: link.
Description

Within Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wilderness.
You are employed by a software company that just has decided to develop a computer version of this game, and you are chosen to implement one of the game’s special rules:
When the game ends, the player who built the longest road gains two extra victory points.
The problem here is that the players usually build complex road networks and not just one linear path. Therefore, determining the longest road is not trivial (although human players usually see it immediately).
Compared to the original game, we will solve a simplified problem here: You are given a set of nodes (cities) and a set of edges (road segments) of length 1 connecting the nodes.
The longest road is defined as the longest path within the network that doesn’t use an edge twice. Nodes may be visited more than once, though.
Example: The following network contains a road of length 12.
o o–o o
\ / \ /
o–o o–o
/ \ /
o o–o o–o
\ /
o–o

Input

The input will contain one or more test cases.
The first line of each test case contains two integers: the number of nodes n (2<=n<=25) and the number of edges m (1<=m<=25). The next m lines describe the m edges. Each edge is given by the numbers of the two nodes connected by it. Nodes are numbered from 0 to n-1. Edges are undirected. Nodes have degrees of three or less. The network is not neccessarily connected.
Input will be terminated by two values of 0 for n and m.

Output

For each test case, print the length of the longest road on a single line.

Sample Input

3 2
0 1
1 2
15 16
0 2
1 2
2 3
3 4
3 5
4 6
5 7
6 8
7 8
7 9
8 10
9 11
10 12
11 12
10 13
12 14
0 0

Sample Output

2
12

题解

枚举每个点搜索找最长路。

#include<stdio.h>
#include<string.h>
#define max(a,b) a>b?a:b
int n,m,u,v,ans;
int maps[33][33];
int vis[33][33];
void dfs(int node,int road)
{for(int i=0; i<n; i++){if(!maps[node][i]||!maps[i][node])continue;if(vis[node][i]||vis[i][node])continue;vis[node][i]=vis[i][node]=1;road++;ans=max(road,ans);dfs(i,road);vis[node][i]=vis[i][node]=0;road--;}
}
int main()
{while(~scanf("%d%d",&n,&m)&&n+m){memset(maps,0,sizeof(maps));ans=0;for(int i=0; i<m; i++){scanf("%d%d",&u,&v);maps[u][v]=maps[v][u]=1;}for(int i=0; i<n; i++){memset(vis,0,sizeof(vis));dfs(i,0);}printf("%d\n",ans);}return 0;
}

H POJ 1040 Transportation

传送门: link.
Description

Ruratania is just entering capitalism and is establishing new enterprising activities in many fields in- cluding transport. The transportation company TransRuratania is starting a new express train from city A to city B with several stops in the stations on the way. The stations are successively numbered, city A station has number 0, city B station number m. The company runs an experiment in order to improve passenger transportation capacity and thus to increase its earnings. The train has a maximum capacity n passengers. The price of the train ticket is equal to the number of stops (stations) between the starting station and the destination station (including the destination station). Before the train starts its route from the city A, ticket orders are collected from all onroute stations. The ticket order from the station S means all reservations of tickets from S to a fixed destination station. In case the company cannot accept all orders because of the passenger capacity limitations, its rejection policy is that it either completely accept or completely reject single orders from single stations.
Write a program which for the given list of orders from single stations on the way from A to B determines the biggest possible total earning of the TransRuratania company. The earning from one accepted order is the product of the number of passengers included in the order and the price of their train tickets. The total earning is the sum of the earnings from all accepted orders.

Input

The input file is divided into blocks. The first line in each block contains three integers: passenger capacity n of the train, the number of the city B station and the number of ticket orders from all stations. The next lines contain the ticket orders. Each ticket order consists of three integers: starting station, destination station, number of passengers. In one block there can be maximum 22 orders. The number of the city B station will be at most 7. The block where all three numbers in the first line are equal to zero denotes the end of the input file.

Output

The output file consists of lines corresponding to the blocks of the input file except the terminating block. Each such line contains the biggest possible total earning.

Sample Input

10 3 4
0 2 1
1 3 5
1 2 7
2 3 10
10 5 4
3 5 10
2 4 9
0 2 5
2 5 8
0 0 0

Sample Output

19
34

I POJ 1315 Don’t Get Rooked

传送门: link.

Description

In chess, the rook is a piece that can move any number of squares vertically or horizontally. In this problem we will consider small chess boards (at most 4x4) that can also contain walls through which rooks cannot move. The goal is to place as many rooks on a board as possible so that no two can capture each other. A configuration of rooks is legal provided that no two rooks are on the same horizontal row or vertical column unless there is at least one wall separating them.
The following image shows five pictures of the same board. The first picture is the empty board, the second and third pictures show legal configurations, and the fourth and fifth pictures show illegal configurations. For this board, the maximum number of rooks in a legal configuration is 5; the second picture shows one way to do it, but there are several other ways.
在这里插入图片描述
Your task is to write a program that, given a description of a board, calculates the maximum number of rooks that can be placed on the board in a legal configuration.

Input

The input contains one or more board descriptions, followed by a line containing the number 0 that signals the end of the file. Each board description begins with a line containing a positive integer n that is the size of the board; n will be at most 4. The next n lines each describe one row of the board, with a ‘.’ indicating an open space and an uppercase ‘X’ indicating a wall. There are no spaces in the input.

Output

For each test case, output one line containing the maximum number of rooks that can be placed on the board in a legal configuration.

Sample Input

4
.X…

XX…

2
XX
.X
3
.X.
X.X
.X.
3

.XX
.XX
4




0

Sample Output

5
1
5
2
4

J UVA 750 8 Queens Chess Problem

传送门: link.

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

相关文章

  1. 单片机 GY-906 MLX90614 红外温度读取

    模块型号:GY-906-BAA,GY-906-BCC,GY-906-DCI BAA 测距是2cm BCC 测距是10CM DCI 测距是一米 资料网盘下载: https://pan.baidu.com/s/1V4IX0PKG8vDOionICghSTw SMBus (System Management Bus,)是 1995 年由 intel 公司提出的一种高效同步串行总线,SMBus 只有两根信号线…...

    2024/5/9 13:28:24
  2. 蓝白社区——博客教程不定期更新(一)

    数据库设计大概解释一下: 1、文章表博文状态–公开;私密;回收站;草稿箱 博文类型–原创;转载2、评论表父级评论–做回复用博客系统,最重要的就是文章表的设计,一篇博文对应一个作者,一个分类,一个状态,多个标签;而一个标签可以有被很多文章使用; 评论表,用户可以评…...

    2024/4/9 1:10:34
  3. PAT---A1119 Pre- and Post-order Traversals (30分)

    题意 给定二叉树的先序和后序遍历,要求判断二叉树是否唯一,并输出任意一种的中序遍历。 思路 仿照先序+中序的思路建树,但是由于不能确定左右子树的位置,所以对左子树的长度进行枚举,如果有两种以上情况的长度都合适,说明不唯一,取其中一种继续下去即可。 Sample Input1…...

    2024/4/9 1:10:33
  4. 从gitlab上用ssh拉取项目

    1、下载安装配置好git 2、对于windows,我是用windows 右键打开 git bash 输入 ssh-keygen -t rsa 然后三次回车 生成密钥成功 3、在C盘的 user或者用户中找到常用的用户名,点进去找到 .ssh文件 打开找到xx_rsa.pub文件,用notepad或者其他文档文件打开,复制里面的码串。 4、…...

    2024/4/29 19:50:58
  5. 【Goland】#{key}=#{value},字符串被格式化了?

    不喜欢看这种格式 #{key}=#{value}不知道什么时候,Goland 的 Editor 默认的字符串,尤其是涉及到 Format 的时候,总会被缩写成这样,很不习惯,非常讨厌,忍无可忍,终于花时间研究了一下怎么取消了,Google 了很久,都没找到答案,于是一个个选项扫下来,终于发现问题了,大…...

    2024/4/21 0:34:38
  6. Spring Cloud微服务架构:消息总线(Kafka)

    Spring Cloud Bus除了支持RabbitMQ的自动化配置之外,还支持现在被广泛应用的Kafka。在本文中,我们将搭建一个Kafka的本地环境,并通过它来尝试使用Spring Cloud Bus对Kafka的支持,实现消息总线的功能。由于本文会以之前Rabbit的实现作为基础来修改,所以先阅读《Spring Clou…...

    2024/4/22 0:32:13
  7. 算法提高(VIP)——贪吃的大嘴

    题目描述 有一只特别贪吃的大嘴,她很喜欢吃一种小蛋糕。 而每一个小蛋糕有一个美味度,而大嘴是很傲娇的,一定要吃美味度之和刚好为 m 的小蛋糕, 而且大嘴还特别懒,她希望通过吃数量最少的小蛋糕达到这个目的. 所以她希望你能设计一个程序帮她决定要吃哪些小蛋糕. 输入格式 …...

    2024/4/28 2:16:59
  8. 学习博客:List常用方法

    学习博客:List常用方法 作为Collection的子类,List得到了Collection的方法,今天讲一些比较另类的。 // A:添加功能 // void add(int index, object element) :在指定位置添加元素 // B :获取功能 // Object get (int, index) : 获职指定位置的元…...

    2024/4/22 16:21:01
  9. docker-compose安装及前后端项目部署

    一、docker-compose安装docker-compose安装之前需要安装docker,docker安装教程看这篇:https://blog.csdn.net/qq_36640395/article/details/1074496521.经过多种安装方式测试,我们选择最稳定的方式,使用python-pip工具安装,首先安装python的依赖,执行命令:yum -y install…...

    2024/4/29 4:30:18
  10. 【Java笔记(55)】EffectiveJava第九条之try-with-resources优先于try-finally

    try-with-resources优先于try-finally try-with-resources需要实现AutoCloseable接口,其中有一个 close:void方法,用来关闭资源 以下代码就能实现自动关闭资源try (BufferedReader br = new BufferedReader(new FileReader(path))) {return br.readLine();}...

    2024/4/8 22:14:41
  11. 初探SpringBoot

    Spring Boot pom.xml 1.父项目 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.3.1.RELEASE</version><relativePath/> <!-- lookup parent from re…...

    2024/4/25 23:06:24
  12. MySQL练习之删除除了自动编号不同,其他都相同的学生冗余信息

    学生表如下:执行语句:delete from students where id not in (select students.id from (select Min(id) as id from students group by name,sex,score,subject) students );...

    2024/5/2 19:01:41
  13. 【剑指offer】面试题39:数组中出现次数超过一半的数字

    39.数组中出现次数超过一半的数字 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。 示例 1:输入: [1, 2, 3, 2, 2, 2, 5, 4, 2] 输出: 2排序 class Solution { public:int majorityElement(vector<int>& nums) {//方法1:排序后中间的元素一定是出现…...

    2024/4/9 1:10:27
  14. 面试题 01.06. 字符串压缩

    字符串压缩。利用字符重复出现的次数,编写一种方法,实现基本的字符串压缩功能。比如,字符串aabcccccaaa会变为a2b1c5a3。若“压缩”后的字符串没有变短,则返回原先的字符串。你可以假设字符串中只包含大小写英文字母(a至z)。 输入:“aabcccccaaa” 输出:“a2b1c5a3” 输…...

    2024/4/12 16:49:41
  15. [LeetCode][C++]快乐数

    快乐数 编写一个算法来判断一个数 n 是不是快乐数。 「快乐数」定义为:对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和,然后重复这个过程直到这个数变为 1,也可能是 无限循环 但始终变不到 1。如果 可以变为 1,那么这个数就是快乐数。 如果 n 是快乐数就返…...

    2024/4/9 1:10:25
  16. 专科低学历想做web前端开发拿10k、15k高薪,我建议你这样做

    并不是所有人都是985、211毕业,学历低的人一样要生活、要工作,那我今天就跟大家分享一些建议。首先,学习路线的建议>>很多零基础、其它行业的同学想要入行前端开发之前,都会在网上去查一些前端开发学习路线之类的资料,想先去整体的了解一下这个行业、岗位、职位等信…...

    2024/4/25 16:15:06
  17. 蜂窝无人机到X的通信:多无人机网络的设计和优化 翻译笔记

    目录AbstractIntroduction背景问题与解决方法文献主要贡献本文的其余部分安排如下系统模型场景描述数据传输二进制U2N和CU子信道配对矩阵二进制U2U子信道配对矩阵信道模型U2N 无人机i→基站路径损耗和信号功率干扰功率信号干扰加噪声比(SINR)和数据速率CU 蜂窝用户i→基站路径…...

    2024/4/24 3:23:24
  18. 计算机网络——基本概念和基础知识

    文章目录计算机网络——基本概念和基础知识CNCN分类CN性能指标网络连接设备因特网体系结构因特网的网际协议IP套接字端口TCP连接localhost127.0.0.1本机IPURI、URL和URNhttps://pan.baidu.com/(URL)DNS网卡MAC地址pingCSMA 计算机网络——基本概念和基础知识 CNCN(计算机网络…...

    2024/4/14 5:52:36
  19. CSS第三天之盒子模型

    1.盒子模型 1.1看透网页布局的本质 网页布局过程:先准备好相关的网页元素,网页元素基本上都是盒子 利用CSS设置好盒子的样式,并且将盒子摆放在合适的位置。 往盒子里面装内容:网页布局的核心:利用css摆盒子。1.2 边框(border) border可以设置盒子得边框,边框有三个属性…...

    2024/4/29 18:40:30
  20. 2020暑期ACM训练总结

    2020暑期ACM训练总结 每次训练总要收获些什么。 7.20牛客第四场 这是自OI退役以来第一次认真打的比赛,最大的感觉就是分析能力明显退化了。 复现: 10题首先看了后3题,J要是最大值就太简单了,次大值一开始猜想整体二分,I不太懂题意,都不是很可做。看到H,上来就是网络流建…...

    2024/4/9 1:10:20

最新文章

  1. 知识付费模式教育系统开发,教育机构裂变营销+社群运营该怎么操作?

    在过去的一段时间&#xff0c;知名教培网站曾对1005家培训机构做了是否转型在线的调查&#xff0c;得到即使面对诸多的困难和不确定性&#xff0c;90%以上的线下机构也必须要走到线上去的结果&#xff0c;而疫情带来的特殊状况&#xff0c;让一半以上的机构选择在招生方式上&am…...

    2024/5/9 13:55:25
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/5/7 10:36:02
  3. C# 构建可定时关闭的异步提示弹窗

    C# 构建可定时关闭的异步提示弹窗 引言1、调用接口的实现2、自动定时窗口的实现 引言 我们在最常用最简单的提示弹框莫过于MessageBox.Show( )的方法了&#xff0c;但是使用久了之后&#xff0c;你会发现这个MessageBox并不是万能的&#xff0c;有事后并不想客户去点击&#x…...

    2024/5/7 15:39:44
  4. Vue3学习笔记+报错记录

    文章目录 1.创建Vue3.0工程1.1使用vue-cli创建1.2 使用vite创建工程1.3.分析Vue3工程结构 2.常用Composition2.1 拉开序幕的setup2.2 ref函数_处理基本类型2.3 ref函数_处理对象类型2.4 ref函数使用总结 1.创建Vue3.0工程 1.1使用vue-cli创建 查看vue/cli版本&#xff0c;确保…...

    2024/5/9 10:02:08
  5. Python 潮流周刊#44:Mojo 本周开源了;AI 学会生成音乐了

    △△请给“Python猫”加星标 &#xff0c;以免错过文章推送 你好&#xff0c;我是猫哥。这里每周分享优质的 Python、AI 及通用技术内容&#xff0c;大部分为英文。本周刊开源&#xff0c;欢迎投稿[1]。另有电报频道[2]作为副刊&#xff0c;补充发布更加丰富的资讯&#xff0c;…...

    2024/5/8 12:18:06
  6. 416. 分割等和子集问题(动态规划)

    题目 题解 class Solution:def canPartition(self, nums: List[int]) -> bool:# badcaseif not nums:return True# 不能被2整除if sum(nums) % 2 ! 0:return False# 状态定义&#xff1a;dp[i][j]表示当背包容量为j&#xff0c;用前i个物品是否正好可以将背包填满&#xff…...

    2024/5/8 19:32:33
  7. 【Java】ExcelWriter自适应宽度工具类(支持中文)

    工具类 import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet;/*** Excel工具类** author xiaoming* date 2023/11/17 10:40*/ public class ExcelUti…...

    2024/5/9 7:40:42
  8. Spring cloud负载均衡@LoadBalanced LoadBalancerClient

    LoadBalance vs Ribbon 由于Spring cloud2020之后移除了Ribbon&#xff0c;直接使用Spring Cloud LoadBalancer作为客户端负载均衡组件&#xff0c;我们讨论Spring负载均衡以Spring Cloud2020之后版本为主&#xff0c;学习Spring Cloud LoadBalance&#xff0c;暂不讨论Ribbon…...

    2024/5/9 2:44:26
  9. TSINGSEE青犀AI智能分析+视频监控工业园区周界安全防范方案

    一、背景需求分析 在工业产业园、化工园或生产制造园区中&#xff0c;周界防范意义重大&#xff0c;对园区的安全起到重要的作用。常规的安防方式是采用人员巡查&#xff0c;人力投入成本大而且效率低。周界一旦被破坏或入侵&#xff0c;会影响园区人员和资产安全&#xff0c;…...

    2024/5/8 20:33:13
  10. VB.net WebBrowser网页元素抓取分析方法

    在用WebBrowser编程实现网页操作自动化时&#xff0c;常要分析网页Html&#xff0c;例如网页在加载数据时&#xff0c;常会显示“系统处理中&#xff0c;请稍候..”&#xff0c;我们需要在数据加载完成后才能继续下一步操作&#xff0c;如何抓取这个信息的网页html元素变化&…...

    2024/5/9 3:15:57
  11. 【Objective-C】Objective-C汇总

    方法定义 参考&#xff1a;https://www.yiibai.com/objective_c/objective_c_functions.html Objective-C编程语言中方法定义的一般形式如下 - (return_type) method_name:( argumentType1 )argumentName1 joiningArgument2:( argumentType2 )argumentName2 ... joiningArgu…...

    2024/5/9 5:40:03
  12. 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】

    &#x1f468;‍&#x1f4bb;博客主页&#xff1a;花无缺 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! 本文由 花无缺 原创 收录于专栏 【洛谷算法题】 文章目录 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】&#x1f30f;题目描述&#x1f30f;输入格…...

    2024/5/9 7:40:40
  13. 【ES6.0】- 扩展运算符(...)

    【ES6.0】- 扩展运算符... 文章目录 【ES6.0】- 扩展运算符...一、概述二、拷贝数组对象三、合并操作四、参数传递五、数组去重六、字符串转字符数组七、NodeList转数组八、解构变量九、打印日志十、总结 一、概述 **扩展运算符(...)**允许一个表达式在期望多个参数&#xff0…...

    2024/5/8 20:58:56
  14. 摩根看好的前智能硬件头部品牌双11交易数据极度异常!——是模式创新还是饮鸩止渴?

    文 | 螳螂观察 作者 | 李燃 双11狂欢已落下帷幕&#xff0c;各大品牌纷纷晒出优异的成绩单&#xff0c;摩根士丹利投资的智能硬件头部品牌凯迪仕也不例外。然而有爆料称&#xff0c;在自媒体平台发布霸榜各大榜单喜讯的凯迪仕智能锁&#xff0c;多个平台数据都表现出极度异常…...

    2024/5/9 1:35:21
  15. Go语言常用命令详解(二)

    文章目录 前言常用命令go bug示例参数说明 go doc示例参数说明 go env示例 go fix示例 go fmt示例 go generate示例 总结写在最后 前言 接着上一篇继续介绍Go语言的常用命令 常用命令 以下是一些常用的Go命令&#xff0c;这些命令可以帮助您在Go开发中进行编译、测试、运行和…...

    2024/5/9 4:12:16
  16. 用欧拉路径判断图同构推出reverse合法性:1116T4

    http://cplusoj.com/d/senior/p/SS231116D 假设我们要把 a a a 变成 b b b&#xff0c;我们在 a i a_i ai​ 和 a i 1 a_{i1} ai1​ 之间连边&#xff0c; b b b 同理&#xff0c;则 a a a 能变成 b b b 的充要条件是两图 A , B A,B A,B 同构。 必要性显然&#xff0…...

    2024/5/9 7:40:35
  17. 【NGINX--1】基础知识

    1、在 Debian/Ubuntu 上安装 NGINX 在 Debian 或 Ubuntu 机器上安装 NGINX 开源版。 更新已配置源的软件包信息&#xff0c;并安装一些有助于配置官方 NGINX 软件包仓库的软件包&#xff1a; apt-get update apt install -y curl gnupg2 ca-certificates lsb-release debian-…...

    2024/5/8 18:06:50
  18. Hive默认分割符、存储格式与数据压缩

    目录 1、Hive默认分割符2、Hive存储格式3、Hive数据压缩 1、Hive默认分割符 Hive创建表时指定的行受限&#xff08;ROW FORMAT&#xff09;配置标准HQL为&#xff1a; ... ROW FORMAT DELIMITED FIELDS TERMINATED BY \u0001 COLLECTION ITEMS TERMINATED BY , MAP KEYS TERMI…...

    2024/5/9 7:40:34
  19. 【论文阅读】MAG:一种用于航天器遥测数据中有效异常检测的新方法

    文章目录 摘要1 引言2 问题描述3 拟议框架4 所提出方法的细节A.数据预处理B.变量相关分析C.MAG模型D.异常分数 5 实验A.数据集和性能指标B.实验设置与平台C.结果和比较 6 结论 摘要 异常检测是保证航天器稳定性的关键。在航天器运行过程中&#xff0c;传感器和控制器产生大量周…...

    2024/5/9 1:42:21
  20. --max-old-space-size=8192报错

    vue项目运行时&#xff0c;如果经常运行慢&#xff0c;崩溃停止服务&#xff0c;报如下错误 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 因为在 Node 中&#xff0c;通过JavaScript使用内存时只能使用部分内存&#xff08;64位系统&…...

    2024/5/9 5:02:59
  21. 基于深度学习的恶意软件检测

    恶意软件是指恶意软件犯罪者用来感染个人计算机或整个组织的网络的软件。 它利用目标系统漏洞&#xff0c;例如可以被劫持的合法软件&#xff08;例如浏览器或 Web 应用程序插件&#xff09;中的错误。 恶意软件渗透可能会造成灾难性的后果&#xff0c;包括数据被盗、勒索或网…...

    2024/5/9 4:31:45
  22. JS原型对象prototype

    让我简单的为大家介绍一下原型对象prototype吧&#xff01; 使用原型实现方法共享 1.构造函数通过原型分配的函数是所有对象所 共享的。 2.JavaScript 规定&#xff0c;每一个构造函数都有一个 prototype 属性&#xff0c;指向另一个对象&#xff0c;所以我们也称为原型对象…...

    2024/5/8 12:44:41
  23. C++中只能有一个实例的单例类

    C中只能有一个实例的单例类 前面讨论的 President 类很不错&#xff0c;但存在一个缺陷&#xff1a;无法禁止通过实例化多个对象来创建多名总统&#xff1a; President One, Two, Three; 由于复制构造函数是私有的&#xff0c;其中每个对象都是不可复制的&#xff0c;但您的目…...

    2024/5/8 9:51:44
  24. python django 小程序图书借阅源码

    开发工具&#xff1a; PyCharm&#xff0c;mysql5.7&#xff0c;微信开发者工具 技术说明&#xff1a; python django html 小程序 功能介绍&#xff1a; 用户端&#xff1a; 登录注册&#xff08;含授权登录&#xff09; 首页显示搜索图书&#xff0c;轮播图&#xff0…...

    2024/5/9 6:36:49
  25. 电子学会C/C++编程等级考试2022年03月(一级)真题解析

    C/C++等级考试(1~8级)全部真题・点这里 第1题:双精度浮点数的输入输出 输入一个双精度浮点数,保留8位小数,输出这个浮点数。 时间限制:1000 内存限制:65536输入 只有一行,一个双精度浮点数。输出 一行,保留8位小数的浮点数。样例输入 3.1415926535798932样例输出 3.1…...

    2024/5/9 4:33:29
  26. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  27. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  28. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  29. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  30. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  31. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  32. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  33. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  34. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  35. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  36. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  37. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  38. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  39. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  40. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  41. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  42. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  43. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  44. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  45. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57