uva 10791
uva 11151 Longest Palindrome (最长公共子序列)[通俗易懂]
大家好,又见面了,我是你们的朋友全栈君。 uva 11151 Longest PalindromeA palindrome is a string that reads the same from the left as it does from the right. For example, I, GAG and MADAM are palindromes, but ADAM is not.
日期 2023-06-12 10:48:40python-louvain_louvin算法
本发明涉及数据挖掘技术领域,尤其涉及一种基于Louvain算法的社区发现方法及一种基于Louvain算法的社区发现系统背景技术:随着信息化技术的发展,信息系统中保存着大量用户的信息特征,用户与用户之间也存在着某种关联性。用户的特征具有多维度,且多关联性。社区发现能帮助人们更有效地了解网络的结构特征,从而提供更有效、更具个性化的服务。当前,许多研究通过分析网络的结构来发现社区。其中,Blondel等
日期 2023-06-12 10:48:40E - What a Ridiculous Election UVALive - 7672 【 BFS ,预处理各种状态 】
E - What a Ridiculous Election UVALive - 7672 In country Light Tower, a presidential election is going on. There are two candidates, Mr. X1 and Mr. X2, and both of them are not like good persons. One
日期 2023-06-12 10:48:40哈夫曼树 编码-【UVA No. 12676】转换哈夫曼编码 Inverting Huffman
【UVA No. 12676】转换哈夫曼编码 洛谷题目地址 【题意】 静态哈夫曼编码是一种主要用于文本压缩的编码算法。给定一个由N 个不同字符组成的特定长度的文本,算法选择N 个编码哈夫曼树 编码,每个不同的字符都对应一个编码。使用这些编码压缩文本,当选择编码算法构建一个具有N 个叶子的二叉树时,对于N ≥2,树的构建流程如下。 ① 对文本中的每个不同字符,都构建一个仅包含单个节点
日期 2023-06-12 10:48:40Maximum GCD(UVA 11827)
Problem:Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible pair of these integers. Input :The first line of input is an integer N (1 < N < 100) t
日期 2023-06-12 10:48:40Java实现偶数矩阵(Even Parity, UVa 11464)
偶数矩阵(Even Parity, UVa 11464) 问题描述 给你一个n×n的01矩阵(每个元素非0即1),你的任务是把尽
日期 2023-06-12 10:48:40Java实现偶数矩阵(Even Parity, UVa 11464)
偶数矩阵(Even Parity
日期 2023-06-12 10:48:40UVA 11825 Hackers’ Crackdown(集合动态规划 子集枚举)
Hackers’ Crackdown Miracle Corporations has a number of system services running in a distributed computer system which is a prime target for hackers. The system is basically a set of N&nb
日期 2023-06-12 10:48:40UVA 10739 String to Palindrome(动态规划 回文)
String to Palindrome 题目大意:给出一个字符串s,现在可以进行3种操作(添加字母,删除字母,替换字母),将其变成回文串,求出最少的操作次数。比如abccda,可以用删除操作,删除b,d两步可变成回文;但如果用替换操作,把b换成d则只需要1步。 分析:刚开始我一直考虑它是否具有最优子结构性质,直到现在,还是不明白为什么可以用动态规划来做,大神若是看见,还望指教。 由于添加字
日期 2023-06-12 10:48:40UVA 11078 Open Credit System(扫描 维护最大值)
Open Credit System In an open credit system, the students can choose any course they like, but there is a problem. Some of the students are more senior than other students. The professor of such a co
日期 2023-06-12 10:48:40UVA 1401 Remember the Word(用Trie加速动态规划)
Remember the Word Neal is very curious about combinatorial problems, and now here comes a problem about words. Knowing that Ray has a photographic memory and this may not trouble him, Neal gives it t
日期 2023-06-12 10:48:40UVA 12097 LA 3635 Pie(二分法)
Pie My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming
日期 2023-06-12 10:48:40UVA 11464 Even Parity(部分枚举 递推)
Even Parity We have a grid of size N x N. Each cell of the grid initially contains a zero(0) or a one(1). The parity of a cell is the number of 1s surrounding that cell.
日期 2023-06-12 10:48:40UVA 10881 Piotr's Ants(等效变换 sort结构体排序)
Piotr's AntsTime Limit: 2 seconds Piotr likes playing with ants. He has n of them on a horizontal pole L cm long. Each ant is facing either left or right and walks at a con
日期 2023-06-12 10:48:40UVA 11729 - Commando War(贪心 相邻交换法)
Commando War There is a war and it doesn't look very promising for your country. Now it's time to act. You have a commando squad at your disposal and planning an ambush on an important enemy camp loc
日期 2023-06-12 10:48:40UVA 10066 The Twin Towers(LCS)
Problem B The Twin Towers Input: standard input Output: standard output Once upon a time, in an ancient Empire, there were two towers of dissimilar shapes in two different cities. T
日期 2023-06-12 10:48:40UVa 10082 WERTYU
点击打开链接 题意:给定一个n*m的矩阵,问有多少种方法放置两个相互攻击的皇后?规定在同一行同一列和同对角线的能够相互攻击 1 先考虑同一行的情况,n行就有n种情况,每一行有m*(m-1)种,总的是n*m*(m-1); 2 考虑同... 1 对于一个无向图来说如果这个图是一个欧拉图,那么必须满足该图是连通的并且每个点的度数都是偶数 2 题目给定n条边的无向图问我们是否是一个欧拉图,是的话
日期 2023-06-12 10:48:40【习题 4-8 UVA - 12108】Extraordinarily Tired Students
【链接】 我是链接,点我呀:) 【题意】 【题解】 一个单位时间、一个单位时间地模拟就好。 然后对于每个人。 记录它所处的周期下标idx 每个单位时间都会让每个人的idx++ 注意从醒着到睡着的分界线的处理就好。 可以多循环几次。。超过上限认为无解 (其他题解也提供了一种方法,就是如果状态和初始的情况相同的话。就无解了即形成了一个环。 (可能如果无解一定会形成环? 【代码】
日期 2023-06-12 10:48:40【习题 4-5 Uva1590】 IP Networks
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 假设从第i位开始有不一样的。 那么就把i+1..32位全都置0. 掩码的话类似。前i为全为1,后面32-i位全0. 尽量让后面的连续0(等于掩码最后的0的个数)晚一点出现。 这样网络表示的范围比较小(可供变化的范围比较小)。 【代码】 #include <bits/stdc++.h> #defin
日期 2023-06-12 10:48:40【习题 8-19 UVA-1312】Cricket Field
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 添加两个y坐标0和h 然后从这n+2个y坐标中任选两个坐标,作为矩形的上下界。 然后看看哪些点在这个上下界中。 定义为坐标集合S S中的点的相邻x坐标差和上下界的差的较小值是这个矩形能够构成的最大正方形。 枚举所有情况就好。 【代码】 #include <bits/stdc++.h> #defin
日期 2023-06-12 10:48:40【习题 8-6 UVA - 1611】 Crane
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 想把数字i从位置j移动到位置i 可以这样。 假设mov(x,y)表示将(x..x+len/2-1)和(x+len/2..y)交换。 则可以先进行mov(j,i-1)操作。 (如果(j,i-1)的长度为奇数,终点就变为i-2) 令len = (i-1)-j+1 //当然长度为奇数的时候就是(i-2)-j+1了 x
日期 2023-06-12 10:48:40【例题 8-12 UVA-12627】Erratic Expansion
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 规律+递归题 f[k][i] k时刻前i行的红气球个数 i<=2^(k-1) f[k][i] = 2*f[k-1][i]; i>2^(k-1) f[k][i] = 2*c[k-1] + f[k-1][i-2^(k-1)]; c[
日期 2023-06-12 10:48:40【例题 8-4 UVA - 11134】Fabled Rooks
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 显然把问题分解成两个子问题。 x轴和y轴分别做。 即n个点要求第i个点在[li,ri]范围内。(ri<=n) 问是否可行. 按左端点、右端点排。尽量取左边的方法是错的。 hack数据:(1,1),(1,3),(2,2) 在安排idx=2的时候,优先用了(1,3)这个区间。导致原本3可以放的。现在放不了了。
日期 2023-06-12 10:48:40【习题 7-10 Uva11214】Guarding the Chessboard
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 迭代加深搜索。 可以想见最后深度不会很深吧。。 然后皇后之间互相攻击到是允许的。。 就这样 【代码】 /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.C
日期 2023-06-12 10:48:40【习题 7-9 UVA-1604】Cubic Eight-Puzzle
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 IDA* 保证这次移动的方格不和前一次重复。 然后加一个8数码的剪枝就行了。 ->看看当前状态和目标状态有多少个地方是不一样的。 如果当前的步数加上它仍然比答案大。 显然可以剪枝。 因为不同的数目肯定小于等于要移动的数目; (每次移动最多只能让一个方格还原) (然后只要记录上面和前面的颜色就好了 剩下一个面
日期 2023-06-12 10:48:40【习题 7-8 UVA-12107】Digit Puzzle
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 迭代加深搜索。 枚举最大层数。(也即改变的数字个数 然后枚举第一个改哪个数字,第二个改哪个数字。。 一定要注意字典序问题。 每次优先改成较小的字典序(也即顺序枚举 然后注意这个字符不改的情况。 不要算改变数。 最后改完之后。 只需要枚举a和b的情况。 看看a*b是不是等于c就好 ->查看这样的a*b数量是不
日期 2023-06-12 10:48:40【习题 7-5 UVA-690】Pipeline Scheduling
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 一定在这里写完思路再敲代码!!! 处理出5个工作单元在哪些时刻会被用到。 ->设为initstatu 因为每次都会面临之前已经用了一段程序,而现在要走下一步的情况 ->但有一些地方是肯定已经不能走了的。 ->我们可以预处理出来哪些地方是可以走的。 ->剩下的.可能不能走.我们再额外处理就好
日期 2023-06-12 10:48:40【例 7-12 UVA - 1343】The Rotation Game
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 迭代加深搜索。 每次抽动操作最多只会让中间那一块的区域离目标的“距离”减少1. 以这个作为剪枝。 枚举最大深度。 就能过了。 【代码】 #include <iostream> #include <cstdlib> #include <cstdio> #include <
日期 2023-06-12 10:48:40【例题 7-2 UVA - 11059】Maximum Product
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 C语言for循环练习题 【代码】 /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.Can you promise that the solution i
日期 2023-06-12 10:48:40【例题 7-1 UVA - 725】Division
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 枚举分母从0到99999. 得到分子,判断合法 【代码】 /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.Can you promise that th
日期 2023-06-12 10:48:40【习题 6-10 UVA - 246】10-20-30
【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 发牌的那个牌堆用一个deque,7个牌堆用vector来模拟。 然后按照题意模拟就好。 不难。 【代码】 /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least therr) yourself? 3.Can you
日期 2023-06-12 10:48:40