说说:
其实这道题是栈这个数据结构最经典的运用,即表达式的求值。与一般情况不同的是,此次要求的运算数是矩阵。在整个解析表达式的过程中,无非遇到三类字符,一个是'(',另一个是‘)’,剩下的就是运算数了。首先,在遇到‘(’的时候,栈指针自动加一,并将栈顶元素的行数和列数都设置为-1,这样就不会和正常的运算数混淆了。如果遇到的是运算数,首先要判断当前的栈顶元素是否为运算数(当然,还要注意栈为空的特殊...
分类:
其他好文 时间:
2014-09-03 21:20:07
阅读次数:
265
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2316题目意思:有 N 个 点,M 条 边。需要构造一个N * M 大小的矩阵A。对于 (i, j) 这个坐标点它表示,对编号为 i 这个点编号为 j 的 点与它相连...
分类:
其他好文 时间:
2014-09-02 19:26:25
阅读次数:
182
九九乘法表作业其实有更简单的做法,就是用列表推导式。-----------------------------------------------------------------------------Print below multiplication table:1*1=11*2=2 2*2...
分类:
编程语言 时间:
2014-09-02 17:13:45
阅读次数:
343
题意:求两个n x n的矩阵相乘后模3的结果,n
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4920
——>>呀呀。。
1、3层计算的for进行缓存优化,根据CPU的L1级缓存的实现原理,减少缓存的变更。如果每次都计算完一个单元格的结果再计算下一个单元格的结果,那么被乘矩阵的访问就会频繁地更新缓存,使效率很低。。
2、输入开挂,G++提...
分类:
其他好文 时间:
2014-09-01 21:15:36
阅读次数:
252
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-09-01 20:59:03
阅读次数:
173
题目:
Divide two integers without using multiplication, division and mod operator.
解析:...
分类:
其他好文 时间:
2014-08-31 22:58:02
阅读次数:
246
1. h(k) = k mod m its is really bad in thepractical. if m = even and k is all even....( m is size of hash table, modulo['m?djul?u)2. multiplication m....
分类:
其他好文 时间:
2014-08-28 07:24:49
阅读次数:
221
Description
In the late 1700s', Gauss, a famous mathematician, found a special kind of numbers. These integers are all in the form:
a + b .The sum and multiplication ofthese integers can be natura...
分类:
其他好文 时间:
2014-08-26 11:46:25
阅读次数:
237
Description
Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication,
exponenti...
分类:
其他好文 时间:
2014-08-25 21:11:14
阅读次数:
183
Problem X
Huge Mod
Input: standard input
Output: standard output
Time Limit: 1 second
The operator for exponentiation is different from the addition, subtraction, multiplication or division opera...
分类:
其他好文 时间:
2014-08-25 11:55:14
阅读次数:
249