小编Hea*_*utt的帖子

P!= NP问题

这不是一个"纯粹的"编程问题,但由于它深入参与编程理论,我认为最好在这里问一下.

关于P NP问题,摘自http://en.wikipedia.org/wiki/P_versus_NP_problem:"实质上,问题P = NP?问:假设可以快速验证是或否问题的答案.那么,答案本身也可以快速计算出来吗?"

我想知道,验证答案的速度与生成解决方案的速度有什么关系?

theory complexity-theory computer-science

10
推荐指数
2
解决办法
954
查看次数

"operator char*"问题

下面的代码预计打印"​​kevin"但是,它的打印垃圾值.我已经检查了调试器."operator char*"调用返回的指针无效.任何的想法?

class Wrapper
{
private:
    char* _data;

public:

    Wrapper(const char* input)
    {
        int length = strlen(input) + 1;
        _data = new char[length];
        strcpy_s(_data, length, input);
    }

    ~Wrapper()
    {
        delete[] _data;
    }

    operator char*()
    {
        return _data;
    }
};

int main()
{
    char* username = Wrapper("kevin");
    printf(username);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++

9
推荐指数
2
解决办法
3050
查看次数

当设备处于横向模式时显示软键盘

此代码似乎不适用于横向模式:

EditText destinationSearch = (EditText) findViewById(R.id.destinationSearch); 
Run Code Online (Sandbox Code Playgroud)

destinationSearch.requestFocus(); InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(destinationSearch,InputMethodManager.SHOW_IMPLICIT);

有没有解决方案在横向模式下显示软键盘?

java android landscape android-softkeyboard

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

以下程序是否符合严格的C99计划?

标题几乎说明了一切,但我会重申这个问题......

以下程序是否符合C99标准的"严格符合程序"?

#include <stdlib.h>
/* Removing any pre-existing macro definition, in case one should exist in the implementation.
 * Seems to be allowed under 7.1.3 para 3, as malloc does not begin with _X where X is any  capital letter.
 * And 7.1.4 para 1 explicitly permits #undef of such macros.
 */
#ifdef malloc    
#undef malloc     
#endif            

/* Macro substitution has no impact on the external name malloc
 * which remains accessible, e.g., via "(malloc)(s)".  Such use of
 * macro …
Run Code Online (Sandbox Code Playgroud)

c

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

如何在WP7中隐藏软键盘?

在TextBox输入中.输入密钥后,我想隐藏软键盘.怎么做代码?

private void OnKeyDownHandler(object sender, KeyEventArgs e)
           {
                if (e.Key != Key.Enter)
                   return;         

...}
Run Code Online (Sandbox Code Playgroud)

soft-keyboard windows-phone-7

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

通过PID获取进程句柄

我想通过进程名称获取进程的句柄.

我有PID,但当我openProcess用来获取句柄时,它总是返回0或180,我用来使PID正常工作的功能

Handle := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ,False,PID);

我该怎么办?

delphi

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