由买买提看人间百态

topics

全部话题 - 话题: row0
(共0页)
K*******i
发帖数: 399
1
来自主题: JobHunting版 - 矩阵置0题
一个MxN的int矩阵,如果某个元素为0, 则把该元素所在的行和列都置0
要求O(1)空间,这样可以么?
#define M 5
#define N 4
void SetZeros(int A[M][N])
{
int row0 = 1;
int col0 = 1;
for (int j = 0; j < N; j++)
{
if (A[0][j] == 0)
{
row0 = 0;
break;
}
}
for (int i = 0; i < M; i++)
{
if (A[i][0] == 0)
{
col0 = 0;
break;
}
}
for (int i = 1; i < M; i++)
{
for (int j = 1; j < N; j++)
{
... 阅读全帖
i**h
发帖数: 424
2
来自主题: CS版 - 求解一道电路编成题
Why 00000100 -> C?
What does 00000011 do?
非专业解答
假设LED电流方向是从01234567 -> abcdefgh
MOV DPTR, #FontData
loop:
MOV R0, P0 ;read current input
CLR C ;clear carry flag
MOV A, 1 ;rowId=0
next_row: ;might need a short delay between rows
MOV R1, DPTR + R0 ;read bitmap from font data
MOV P1, A ;select row
MOV P3, R1 ;light row
RLC A ;rowId++
INC R0 ;next byte... 阅读全帖
b******b
发帖数: 713
3
来自主题: JobHunting版 - 问一道面经题
i will try the brute force way first:
1. create a hashmap, whose key is the sequence of the matrix, e.g. if the
array is: row0[1,2,3,4], row1[5,6,7,8], then key is [1,2,3,4,5,6,7,8], value
is the min step to revert it back to [1,2,3,4,5,6,7,8], put in [1,2,3,4,5,6
,7,8], 0 into the map.
2. write a recursive method,
int min(matrix)
{
if (map.contains(matrix.sequence)) return map.get(...);
opt1 = matrix.copy().swaprow();
int result = Integer.maxValue;;
if (!map.contains(op1))
{
... 阅读全帖
g***i
发帖数: 1972
4
式子应该等于0,不够长了
怎么才能找到用a和row0来表示的lamda1和row1
而和cosQ无关呢?
打不出来那些字母,sorry
P***a
发帖数: 4213
5
☆─────────────────────────────────────☆
gouji (菲*飞*FLY) 于 (Sat Oct 6 17:18:57 2007) 提到:
式子应该等于0,不够长了
怎么才能找到用a和row0来表示的lamda1和row1
而和cosQ无关呢?
打不出来那些字母,sorry
☆─────────────────────────────────────☆
gouji (菲*飞*FLY) 于 (Sat Oct 6 17:31:58 2007) 提到:
55555,做不出来了

☆─────────────────────────────────────☆
cockroach (@UMN) 于 (Sat Oct 6 17:40:57 2007) 提到:
吃完饭给你看一下
☆─────────────────────────────────────☆
gouji (菲*飞*FLY) 于 (Sat Oct 6 17:48:13 2007) 提到:
谢谢谢谢:)
☆─────────────────────────
q*****g
发帖数: 1568
6
来自主题: Programming版 - Python小问题
【 以下文字转载自 Linux 讨论区 】
发信人: qiuxing (球星), 信区: Linux
标 题: Python小问题
发信站: BBS 未名空间站 (Wed Nov 1 15:05:43 2006), 转信
想要实现这么一个东西,大家参谋一下怎么弄最省事:
col0 col1 ...
row0 a00 a01 ...
row1 a10 all ...
.....
就是说带名字的矩阵。要做到可以通过行或者列的名字取出行,列。
要是能够自己带一个排序的method就更好了。
基本的思路是用dictionary套dictionary,但是我想到的方案都比较笨 :-<
又或者有现成的module?
g***i
发帖数: 1972
7
来自主题: Mathematics版 - 请教大牛,大包子感谢
见附件的式子
式子应该等于0,不够长了
怎么才能找到用a和row0来表示的lamda1和row1
而和theta无关呢?
打不出来那些字母,sorry
(共0页)