<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://www.33dai.wiki/index.php?action=history&amp;feed=atom&amp;title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95%2F03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2</id>
	<title>08-基础算法/03-进制转换 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://www.33dai.wiki/index.php?action=history&amp;feed=atom&amp;title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95%2F03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2"/>
	<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95/03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2&amp;action=history"/>
	<updated>2026-05-20T22:23:13Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95/03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2&amp;diff=428&amp;oldid=prev</id>
		<title>33DAI：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95/03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2&amp;diff=428&amp;oldid=prev"/>
		<updated>2026-05-20T18:23:59Z</updated>

		<summary type="html">&lt;p&gt;批量导入三三文档&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 18:23的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l73&quot;&gt;第73行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第73行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:基础算法]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:基础算法]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:三三文档]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:三三文档]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key my_wiki:diff:1.41:old-387:rev-428:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95/03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2&amp;diff=387&amp;oldid=prev</id>
		<title>33DAI：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95/03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2&amp;diff=387&amp;oldid=prev"/>
		<updated>2026-05-20T18:12:13Z</updated>

		<summary type="html">&lt;p&gt;导入1个版本&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 18:12的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff:1.41:old-386:rev-387 --&gt;
&lt;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95/03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2&amp;diff=386&amp;oldid=prev</id>
		<title>-&gt;Importer：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=08-%E5%9F%BA%E7%A1%80%E7%AE%97%E6%B3%95/03-%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2&amp;diff=386&amp;oldid=prev"/>
		<updated>2026-05-20T16:50:33Z</updated>

		<summary type="html">&lt;p&gt;批量导入三三文档&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== 进制转换 ==&lt;br /&gt;
&lt;br /&gt;
=== 常见进制 ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! 进制 !! 基数 !! 字符&lt;br /&gt;
|-&lt;br /&gt;
| 二进制&lt;br /&gt;
| 2&lt;br /&gt;
| 0, 1&lt;br /&gt;
|-&lt;br /&gt;
| 八进制&lt;br /&gt;
| 8&lt;br /&gt;
| 0 ~ 7&lt;br /&gt;
|-&lt;br /&gt;
| 十进制&lt;br /&gt;
| 10&lt;br /&gt;
| 0 ~ 9&lt;br /&gt;
|-&lt;br /&gt;
| 十六进制&lt;br /&gt;
| 16&lt;br /&gt;
| 0 ~ 9, A ~ F&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== 任意进制转十进制 ===&lt;br /&gt;
&lt;br /&gt;
按权展开求和：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;A_{k} = a_n \times k^n + a_{n-1} \times k^{n-1} + \cdots + a_1 \times k^1 + a_0 \times k^0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// 将 k 进制字符串转为十进制整数&lt;br /&gt;
int to_decimal(string s, int k)&lt;br /&gt;
{&lt;br /&gt;
    int res = 0;&lt;br /&gt;
    for (char c : s)&lt;br /&gt;
    {&lt;br /&gt;
        int digit = (c &amp;gt;= &amp;#039;0&amp;#039; &amp;amp;&amp;amp; c &amp;lt;= &amp;#039;9&amp;#039;) ? c - &amp;#039;0&amp;#039; : c - &amp;#039;A&amp;#039; + 10;&lt;br /&gt;
        res = res * k + digit;&lt;br /&gt;
    }&lt;br /&gt;
    return res;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 十进制转任意进制 ===&lt;br /&gt;
&lt;br /&gt;
除基取余，逆序排列：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
// 将十进制整数 x 转为 k 进制字符串&lt;br /&gt;
string from_decimal(int x, int k)&lt;br /&gt;
{&lt;br /&gt;
    if (x == 0) return &amp;quot;0&amp;quot;;&lt;br /&gt;
    string res = &amp;quot;&amp;quot;;&lt;br /&gt;
    while (x)&lt;br /&gt;
    {&lt;br /&gt;
        int r = x % k;&lt;br /&gt;
        char c = (r &amp;lt; 10) ? &amp;#039;0&amp;#039; + r : &amp;#039;A&amp;#039; + r - 10;&lt;br /&gt;
        res = c + res;&lt;br /&gt;
        x /= k;&lt;br /&gt;
    }&lt;br /&gt;
    return res;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 二进制与八进制、十六进制的快速互转 ===&lt;br /&gt;
&lt;br /&gt;
* 二进制 → 八进制：三位一分组&lt;br /&gt;
* 二进制 → 十六进制：四位一分组&lt;br /&gt;
* 反过来同理&lt;br /&gt;
&lt;br /&gt;
[[Category:基础算法]]&lt;br /&gt;
[[Category:三三文档]]&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>-&gt;Importer</name></author>
	</entry>
</feed>