<?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=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF%2F04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91</id>
	<title>02-选择与循环/04-常见循环逻辑 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://www.33dai.wiki/index.php?action=history&amp;feed=atom&amp;title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF%2F04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91"/>
	<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;action=history"/>
	<updated>2026-05-20T23:10:00Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=313&amp;oldid=prev</id>
		<title>33DAI：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=313&amp;oldid=prev"/>
		<updated>2026-05-20T18:12:09Z</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;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&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;2&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;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=312&amp;oldid=prev</id>
		<title>-&gt;Importer：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=312&amp;oldid=prev"/>
		<updated>2026-05-20T16:50:33Z</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;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2026年5月20日 (三) 16:50的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&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;/table&gt;</summary>
		<author><name>-&gt;Importer</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=213&amp;oldid=prev</id>
		<title>33DAI：​导入1个版本</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=213&amp;oldid=prev"/>
		<updated>2026-05-20T16:25:12Z</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日 (三) 16:25的版本&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-212:rev-213 --&gt;
&lt;/table&gt;</summary>
		<author><name>33DAI</name></author>
	</entry>
	<entry>
		<id>https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=212&amp;oldid=prev</id>
		<title>-&gt;Importer：​批量导入三三文档</title>
		<link rel="alternate" type="text/html" href="https://www.33dai.wiki/index.php?title=02-%E9%80%89%E6%8B%A9%E4%B8%8E%E5%BE%AA%E7%8E%AF/04-%E5%B8%B8%E8%A7%81%E5%BE%AA%E7%8E%AF%E9%80%BB%E8%BE%91&amp;diff=212&amp;oldid=prev"/>
		<updated>2026-05-20T16:22:29Z</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;
- &amp;lt;code&amp;gt;max(a, b)&amp;lt;/code&amp;gt;：返回 &amp;lt;math&amp;gt;a,b&amp;lt;/math&amp;gt; 中的较&amp;#039;&amp;#039;&amp;#039;大&amp;#039;&amp;#039;&amp;#039;值。&lt;br /&gt;
- &amp;lt;code&amp;gt;min(a, b)&amp;lt;/code&amp;gt;：返回 &amp;lt;math&amp;gt;a,b&amp;lt;/math&amp;gt; 中的较&amp;#039;&amp;#039;&amp;#039;小&amp;#039;&amp;#039;&amp;#039;值。&lt;br /&gt;
&lt;br /&gt;
下面对于 &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt; 个 &amp;lt;math&amp;gt;1\sim 1000&amp;lt;/math&amp;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;
int n, x, ans;&lt;br /&gt;
cin &amp;gt;&amp;gt; n;&lt;br /&gt;
ans = 0;&lt;br /&gt;
for (int i = 0; i &amp;lt; n; i++)&lt;br /&gt;
{&lt;br /&gt;
    cin &amp;gt;&amp;gt; x;&lt;br /&gt;
    if (x &amp;gt; ans)&lt;br /&gt;
        ans = x;&lt;br /&gt;
}&lt;br /&gt;
cout &amp;lt;&amp;lt; ans &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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;
int n, x, ans;&lt;br /&gt;
cin &amp;gt;&amp;gt; n;&lt;br /&gt;
ans = 1001;&lt;br /&gt;
for (int i = 1; i &amp;lt;= n; i++)&lt;br /&gt;
{&lt;br /&gt;
    cin &amp;gt;&amp;gt; x;&lt;br /&gt;
    ans = min(ans, x);&lt;br /&gt;
}&lt;br /&gt;
cout &amp;lt;&amp;lt; ans &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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;
int n, x, ans;&lt;br /&gt;
cin &amp;gt;&amp;gt; n;&lt;br /&gt;
ans = 0;&lt;br /&gt;
for (int i = 1; i &amp;lt;= n; i++)&lt;br /&gt;
{&lt;br /&gt;
    cin &amp;gt;&amp;gt; x;&lt;br /&gt;
    ans += x;&lt;br /&gt;
}&lt;br /&gt;
cout &amp;lt;&amp;lt; ans &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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;
int n, x, cnt;&lt;br /&gt;
cin &amp;gt;&amp;gt; n;&lt;br /&gt;
cnt = 0;&lt;br /&gt;
for (int i = 1; i &amp;lt;= n; i++)&lt;br /&gt;
{&lt;br /&gt;
    cin &amp;gt;&amp;gt; x;&lt;br /&gt;
    if (x % 2 == 1)&lt;br /&gt;
        cnt++;&lt;br /&gt;
}&lt;br /&gt;
cout &amp;lt;&amp;lt; cnt &amp;lt;&amp;lt; &amp;quot;\n&amp;quot;;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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;
int n;&lt;br /&gt;
cin &amp;gt;&amp;gt; n;&lt;br /&gt;
&lt;br /&gt;
bool flag = true;              // 一开始认为是质数&lt;br /&gt;
if (n &amp;lt;= 1)                    // 大于 1 的自然数&lt;br /&gt;
    flag = false;&lt;br /&gt;
&lt;br /&gt;
for (int i = 2; i &amp;lt;= n - 1; i++) // 除了 1 和它本身以外（2 ~ 本身-1）&lt;br /&gt;
    if (n % i == 0)               // 不再有其他因数的自然数&lt;br /&gt;
        flag = false;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
优化版——只需判断到 &amp;lt;math&amp;gt;\sqrt{n}&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;
bool flag = true;&lt;br /&gt;
if (n &amp;lt;= 1)&lt;br /&gt;
    flag = false;&lt;br /&gt;
for (int i = 2; i * i &amp;lt;= n; i++)&lt;br /&gt;
    if (n % i == 0)&lt;br /&gt;
        flag = false;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 数位分解 ===&lt;br /&gt;
&lt;br /&gt;
- &amp;lt;code&amp;gt;% 10&amp;lt;/code&amp;gt;：得到个位的数值&lt;br /&gt;
- &amp;lt;code&amp;gt;/ 10&amp;lt;/code&amp;gt;：得到去掉个位后的数值&lt;br /&gt;
- 个位：&amp;lt;code&amp;gt;a % 10&amp;lt;/code&amp;gt;&lt;br /&gt;
- 十位：&amp;lt;code&amp;gt;a / 10 % 10&amp;lt;/code&amp;gt;&lt;br /&gt;
- 百位：&amp;lt;code&amp;gt;a / 100 % 10&amp;lt;/code&amp;gt;&lt;br /&gt;
- 千位：&amp;lt;code&amp;gt;a / 1000 % 10&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
while (x &amp;gt; 0)&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; x % 10 &amp;lt;&amp;lt; &amp;quot;,&amp;quot;;&lt;br /&gt;
    x /= 10;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
for (int i = x; i &amp;gt; 0; i /= 10)&lt;br /&gt;
{&lt;br /&gt;
    cout &amp;lt;&amp;lt; i % 10 &amp;lt;&amp;lt; &amp;quot;,&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;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;
int cnt[10] = {0}; // 下标 0~9 分别对应数字 0~9&lt;br /&gt;
while (x &amp;gt; 0)&lt;br /&gt;
{&lt;br /&gt;
    cnt[x % 10]++;&lt;br /&gt;
    x /= 10;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:选择与循环]]&lt;br /&gt;
[[Category:三三文档]]&lt;/div&gt;</summary>
		<author><name>-&gt;Importer</name></author>
	</entry>
</feed>