{"id":45,"date":"2026-03-24T16:43:33","date_gmt":"2026-03-24T08:43:33","guid":{"rendered":"https:\/\/geocommunity.vip\/?p=45"},"modified":"2026-03-31T22:52:07","modified_gmt":"2026-03-31T14:52:07","slug":"%e8%bf%9b%e5%88%b6%e8%bd%ac%e6%8d%a2","status":"publish","type":"post","link":"https:\/\/geocommunity.vip\/index.php\/2026\/03\/24\/%e8%bf%9b%e5%88%b6%e8%bd%ac%e6%8d%a2\/","title":{"rendered":"\u8fdb\u5236\u8f6c\u6362\uff08A\uff09"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">1\u3001\u4efb\u610f\u8fdb\u5236\u8f6c\u5341\u8fdb\u5236<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>long long anyToDecimal(char *str, int base) {\n    long long result = 0;\n    for (int i = 0; str&#91;i]; i++) {\n        int digit = isdigit(str&#91;i]) ? str&#91;i] - '0' : toupper(str&#91;i]) - 'A' + 10;\n        result = result * base + digit;\n    }\n    return result;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee3\u7801\u4e2d\u7684toupper\u662f\u5c06\u5c0f\u5199\u5b57\u6bcd\u8f6c\u4e3a\u5927\u5199\u5b57\u6bcd\u3002result = result * base + digit\u4ee3\u7801\u662f\u6700\u6838\u5fc3\u7684\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5341\u8fdb\u5236\uff08\u975e\u8d1f\u6574\u6570\uff09\u8f6c\u4efb\u610f\u8fdb\u5236<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void decimalToAny(long long num, int base, char *output) {\n    char digits&#91;] = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\";\n    char temp&#91;100];\n    int index = 0;\n\n    if (num == 0) {\n        output&#91;0] = '0';\n        output&#91;1] = '\\0';\n        return;\n    }\n\n    while (num > 0) {\n        temp&#91;index++] = digits&#91;num % base];\n        num \/= base;\n    }\n\n    for (int i = 0; i &lt; index; i++) {\n        output&#91;i] = temp&#91;index - 1 - i];\n    }\n    output&#91;index] = '\\0';\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5148\u4e0d\u65ad\u6574\u9664\u53d6\u4f59\u586b\u5145temp\u6570\u7ec4\uff0c\u6700\u540e\u522b\u5fd8\u8bb0\u5c06temp\u6570\u7ec4\u53cd\u8f6c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u4efb\u610f\u8fdb\u5236\u8f6c\u4efb\u610f\u8fdb\u5236<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void anyToAny(char *input, int fromBase, int toBase, char *output) {\n    long long decimal = anyToDecimal(input, fromBase);\n    decimalToAny(decimal, toBase, output);\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u91c7\u7528\u4e2d\u8f6c\u6cd5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u4efb\u610f\u8fdb\u5236\u8f6c\u5341\u8fdb\u5236 \u4ee3\u7801\u4e2d\u7684toupper\u662f\u5c06\u5c0f &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-7"],"_links":{"self":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":2,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":88,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions\/88"}],"wp:attachment":[{"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geocommunity.vip\/index.php\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}