我总是记不住电话号码。我需要一个记忆规则。


当前回答

我在c#中做了几个天才的方法,你可以在你的生产环境中利用:

public static int GetIntMaxValueGenius1()
{
    int n = 0;
    while (++n > 0) { }
    return --n;
}

public static int GetIntMaxValueGenius2()
{
    int n = 0;
    try
    {
        while (true)
            n = checked(n + 1);
    }
    catch { }
    return n;
}

其他回答

Int32意味着你有32位可用来存储你的数字。最高位是符号位,这表示数字是正还是负。所以正数和负数都有2^31位。

如果0是正数,则得到(前面提到过)的逻辑范围

+2147483647到-2147483648

如果你认为这太小了,请使用Int64:

+9223372036854775807 至 -9223372036854775808

你为什么要记住这个号码?在代码中使用?您应该始终使用Int32。MaxValue或Int32。因为这些是静态值(在.net核心中),因此使用起来比用代码创建一个新的int更快。

我的陈述:如果能记住这个数字。你这是在炫耀!

我能想到的最正确的答案是Int32.MaxValue。

记住这个: 21智商项目47

它可以用任何一个电话板来解码,或者你可以自己在纸上写一个。

为了记住“21 IQ ITEM 47”,我认为“刺客:代号47有21个任务,每个任务都是独立的IQ ITEM”。

或者“我每天21:47刷牙,因为我智商高,不喜欢嘴里有东西”。

在C语言中,在#include <stdint.h>后使用INT32_MAX。 在c++中,在#include <cstdint>后使用INT32_MAX。

或INT_MAX平台特定的大小或UINT32_MAX或UINT_MAX unsigned int。参见http://www.cplusplus.com/reference/cstdint/和http://www.cplusplus.com/reference/climits/。

或运算符(int)。

最大负值(32位):-2147483648 (1 << 31)

最大正(32位)值:2147483647 ~(1 << 31)

记忆:“醉酒又好色”

drunk ========= Drinking age is 21
AK ============ AK 47
A ============= 4 (A and 4 look the same)
horny ========= internet rule 34 (if it exists, there's 18+ material of it) 

21 47 4(years) 3(years) 4(years)
21 47 48       36       48