随笔分类 -  高斯消元法

HDU 4818 RP problem (高斯消元, 2013年长春区域赛F题)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4818深深地补一个坑~~~现场赛坑在这题了,TAT。。。。今天把代码改了下,过掉了,TAT很明显的高斯消元的模型。现场一开始想的也大概是对的。根据度可以得到n个方程,加起来为1是一个方程,有一个是多余的。 加起来就是n个方程。只可能是无穷解和唯一解的情况。现场是先求解一遍,然后枚举所有可以加的,不停做高斯消元。但是因为高斯消元是O(n^3) 的, 再枚举的话就是n^4了。。。。这样做明显应该超时的,HDU交了这样做也是TLE,,,现场被坑死,一直返回WA, 然后程序就改得不成样子了。。。其实枚举那个 阅读全文

posted @ 2014-02-26 00:01 kuangbin 阅读(3152) 评论(2) 推荐(0)

SGU 275. To xor or not to xor (高斯消元法)
摘要:题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=275题意:给你n个数,可以选择任意个数异或,但是要使得最后的异或值最大。我们把每个数用二进制表示,要使得最后的异或值最大,就是要让高位尽量为1,高位能不能为1就必须用高斯消元判断了。1. 根据数的二进制表示,建立方程组的矩阵,结果那列置为1。2. 从下往上高斯消元(高位放下面),如果该行有未被控制的变元,则该行的结果一定为1,且该变元控制该行。3. 从该行往上依次消掉(异或)该变元。4. 如果该行没有可以用来控制的变元,如果最后一列是0,则该行结果也为1,否则该行结果为0。这里能 阅读全文

posted @ 2014-01-31 01:17 kuangbin 阅读(1807) 评论(0) 推荐(0)

SGU 200. Cracking RSA (高斯消元求自由变元个数)
摘要:题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=200200. Cracking RSAtime limit per test: 0.25 sec.memory limit per test: 65536 KBinput: standardoutput: standardThe following problem is somehow related to the final stage of many famous integer factorization algorithms involved in some crypto 阅读全文

posted @ 2014-01-21 13:25 kuangbin 阅读(2030) 评论(0) 推荐(0)

HDU 3976 Electric resistance (高斯消元法)
摘要:Electric resistanceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 326Accepted Submission(s): 156Problem DescriptionNow give you a circuit who has n nodes (marked from 1 to n) , please tell abcdxyzk the equivalent resistance of the circuit between 阅读全文

posted @ 2013-11-17 23:36 kuangbin 阅读(1892) 评论(0) 推荐(0)

POJ 1222 POJ 1830 POJ 1681 POJ 1753 POJ 3185 高斯消元求解一类开关问题
摘要:http://poj.org/problem?id=1222http://poj.org/problem?id=1830http://poj.org/problem?id=1681http://poj.org/problem?id=1753http://poj.org/problem?id=3185这几个题目都类似,都可以使用高斯消元来求解一个模2的01方程组来解决。有时候需要枚举自由变元,有的是判断存不存在解POJ 1222EXTENDED LIGHTS OUT普通的问题。肯定有唯一解。肯定枚举第一行去做,也可以使用高斯消元。 1 /* **************************. 阅读全文

posted @ 2013-08-17 22:12 kuangbin 阅读(3049) 评论(0) 推荐(1)

高斯消元法(模板)
摘要:#include<stdio.h>#include<algorithm>#include<iostream>#include<string.h>#include<math.h>using namespace std;const int MAXN=50;int a[MAXN][MAXN];//增广矩阵int x[MAXN];//解集bool free_x[MAXN];//标记是否是不确定的变元/*void Debug(void){ int i, j; for (i = 0; i < equ; i++) { for (j = 0; 阅读全文

posted @ 2012-09-01 20:59 kuangbin 阅读(17766) 评论(7) 推荐(2)

POJ 2065 SETI(高斯消元)
摘要:SETITime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 1148Accepted: 691DescriptionFor some years, quite a lot of work has been put into listening to electromagnetic radio signals received from space, in order to understand what civilizations in distant galaxies might be trying to tell us. One 阅读全文

posted @ 2012-09-01 13:12 kuangbin 阅读(1086) 评论(0) 推荐(0)

POJ 2947 Widget Factory(高斯消元法,解模线性方程组)
摘要:Widget FactoryTime Limit: 7000MSMemory Limit: 65536KTotal Submissions: 3412Accepted: 1114DescriptionThe widget factory produces several different kinds of widgets. Each widget is carefully built by a skilled widgeteer. The time required to build a widget depends on its type: the simple widgets need 阅读全文

posted @ 2012-08-31 22:51 kuangbin 阅读(1698) 评论(1) 推荐(1)

POJ 3185 The Water Bowls(高斯消元)
摘要:The Water BowlsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 3340Accepted: 1298DescriptionThe cows have a line of 20 water bowls from which they drink. The bowls can be either right-side-up (properly oriented to serve refreshing cool water) or upside-down (a position which holds no water) 阅读全文

posted @ 2012-08-31 21:52 kuangbin 阅读(741) 评论(0) 推荐(0)

POJ 1830 开关问题(高斯消元)
摘要:开关问题Time Limit: 1000MSMemory Limit: 30000KTotal Submissions: 4016Accepted: 1399Description有N个相同的开关,每个开关都与某些开关有着联系,每当你打开或者关闭某个开关的时候,其他的与此开关相关联的开关也会相应地发生变化,即这些相联系的开关的状态如果原来为开就变为关,如果为关就变为开。你的目标是经过若干次开关操作后使得最后N个开关达到一个特定的状态。对于任意一个开关,最多只能进行一次开关操作。你的任务是,计算有多少种可以达到指定状态的方法。(不计开关操作的顺序)Input输入第一行有一个数K,表示以下有K组测 阅读全文

posted @ 2012-08-31 21:37 kuangbin 阅读(1061) 评论(0) 推荐(0)

POJ 1753 Flip Game(高斯消元)
摘要:Flip GameTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 20103Accepted: 8710DescriptionFlip game is played on a rectangular 4x4 field with tw... 阅读全文

posted @ 2012-08-31 21:11 kuangbin 阅读(826) 评论(0) 推荐(0)

POJ 1681 Painter's Problem(高斯消元法)
摘要:Painter's ProblemTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 3441Accepted: 1696DescriptionThere is a square wall which is made of n*n small square bricks. Some bricks are white while some bricks are yellow. Bob is a painter and he wants to paint all the bricks yellow. But there is s 阅读全文

posted @ 2012-08-31 20:16 kuangbin 阅读(2642) 评论(1) 推荐(1)

POJ 1222 EXTENDED LIGHTS OUT(高斯消元法)
摘要:EXTENDED LIGHTS OUTTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4669Accepted: 3073DescriptionIn an extended version of the game Lights Out, is a puzzle with 5 rows of 6 buttons each (the actual puzzle has 5 rows of 5 buttons each). Each button has a light. When a button is pressed, that 阅读全文

posted @ 2012-08-31 14:06 kuangbin 阅读(1643) 评论(0) 推荐(0)

导航

JAVASCRIPT: