小编Mad*_*att的帖子

在Verilog中使用wire或reg与输入或输出

当您将某些内容声明为输入或输出时,您如何知道是否必须将其声明为a reg或a wire

verilog

34
推荐指数
4
解决办法
11万
查看次数

将汇编代码转换为C代码

可以使用什么过程将汇编代码转换为等效的C代码?可以利用哪种工具来获得更高的结果准确度?

assembly disassembly

7
推荐指数
2
解决办法
3万
查看次数

为什么这个正则表达式与第二个二进制间隙不匹配?

尝试上市问题的解决这里的蟒蛇,我想我会尝试一个可爱的小正则表达式来捕获的最大"二元鸿沟"(在一个数字的二进制表示零的链).

我为这个问题写的函数如下:

def solution(N):
    max_gap = 0
    binary_N = format(N, 'b')
    list = re.findall(r'1(0+)1', binary_N)

    for element in list:
        if len(element) > max_gap:
            max_gap = len(element)

    return max_gap
Run Code Online (Sandbox Code Playgroud)

它运作得很好.但是......由于某种原因,它与10000010000000001(二进制表示66561)中的第二组零不匹配.9个零没有出现在匹配列表中,因此它必须是正则表达式的问题 - 但我无法看到它在哪里,因为它匹配给定的每个其他示例!

python regex

3
推荐指数
1
解决办法
444
查看次数

检查数组是否为回文的程序

我正在尝试创建一个程序,该程序检查给定的数组/字符串是否是回文,并且不起作用。该程序仅在每个给定的数组上打印“ 0”,即使在回文上也是如此。

int main()
{

    char string[100]= {0};
    char stringReverse[100]= {0};

    int temp = 0;
    int firstLetter = 0;
    int lastLetter = 0;

    printf("Please enter a word or a sentence: ");
    fgets(string, 100, stdin);

    strcpy(stringReverse , string); // This function copies the scanned array to a new array called "stringReverse"

    firstLetter = 0;
    lastLetter = strlen(string) - 1;    //because in array, the last cell is NULL

    // This while reverses the array and insert it to a new array called …
Run Code Online (Sandbox Code Playgroud)

c string palindrome

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

assembly ×1

c ×1

disassembly ×1

palindrome ×1

python ×1

regex ×1

string ×1

verilog ×1