<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://www.typea.info/tips_/index.php?action=history&amp;feed=atom&amp;title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97</id>
	<title>Python 組合せと順列の計算 - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://www.typea.info/tips_/index.php?action=history&amp;feed=atom&amp;title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97"/>
	<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;action=history"/>
	<updated>2026-06-21T13:08:58Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=6521&amp;oldid=prev</id>
		<title>2020年2月16日 (日) 04:31にPirotoによる</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=6521&amp;oldid=prev"/>
		<updated>2020-02-16T04:31:05Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2020年2月16日 (日) 04:31時点における版&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-l1&quot; &gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;==Python 組合せと順列の計算==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[&lt;/ins&gt;Python 組合せと順列の計算&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]]&lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;[[Python]] | &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;{{category &lt;/del&gt;アルゴリズム&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Python]] | &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[Category:&lt;/ins&gt;アルゴリズム&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;===組合せと順列を計算してみる===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;===組合せと順列を計算してみる===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;=====サンプル=====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;=====サンプル=====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=5255&amp;oldid=prev</id>
		<title>2020年2月15日 (土) 08:38にPirotoによる</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=5255&amp;oldid=prev"/>
		<updated>2020-02-15T08:38:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2020年2月15日 (土) 08:38時点における版&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-l1&quot; &gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;==Python 組合せと順列の計算==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;==Python 組合せと順列の計算==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;[[Python]]{{category アルゴリズム}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Python]] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;| &lt;/ins&gt;{{category アルゴリズム}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;===組合せと順列を計算してみる===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;===組合せと順列を計算してみる===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;=====サンプル=====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;=====サンプル=====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=3599&amp;oldid=prev</id>
		<title>2020年2月15日 (土) 08:05にPirotoによる</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=3599&amp;oldid=prev"/>
		<updated>2020-02-15T08:05:21Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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;ja&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← 古い版&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;2020年2月15日 (土) 08:05時点における版&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-l1&quot; &gt;1行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;1行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;==Python 組合せと順列の計算==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;==Python 組合せと順列の計算==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;[Python]{{category アルゴリズム}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[&lt;/ins&gt;[Python&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;]&lt;/ins&gt;]{{category アルゴリズム}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;===組合せと順列を計算してみる===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;===組合せと順列を計算してみる===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;=====サンプル=====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;=====サンプル=====&lt;/div&gt;&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-l78&quot; &gt;78行目:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;78行目:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;====1行====&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;====1行====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;*Pytho3.x では、functioolsのimportが必要、2.7xでは不要&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;*Pytho3.x では、functioolsのimportが必要、2.7xでは不要&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/del&gt;from functools import reduce&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&amp;amp;gt;&amp;amp;gt; &lt;/ins&gt;from functools import reduce&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/del&gt;cmb = lambda n,r:reduce(lambda x,y:x*y,range(n,n-r,-1))/reduce(lambda x,y:x*y,range(r,1,-1))&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&amp;amp;gt;&amp;amp;gt; &lt;/ins&gt;cmb = lambda n,r:reduce(lambda x,y:x*y,range(n,n-r,-1))/reduce(lambda x,y:x*y,range(r,1,-1))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/del&gt;cmb(7,3)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;gt;&amp;amp;gt;&amp;amp;gt; &lt;/ins&gt;cmb(7,3)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;  35.0&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;  35.0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
	<entry>
		<id>https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=2430&amp;oldid=prev</id>
		<title>Piroto: ページの作成:「==Python 組合せと順列の計算==  [Python]{{category アルゴリズム}}  ===組合せと順列を計算してみる===  =====サンプル=====   # -*- encoding:ut…」</title>
		<link rel="alternate" type="text/html" href="https://www.typea.info/tips_/index.php?title=Python_%E7%B5%84%E5%90%88%E3%81%9B%E3%81%A8%E9%A0%86%E5%88%97%E3%81%AE%E8%A8%88%E7%AE%97&amp;diff=2430&amp;oldid=prev"/>
		<updated>2020-02-15T07:35:10Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「==Python 組合せと順列の計算==  [Python]{{category アルゴリズム}}  ===組合せと順列を計算してみる===  =====サンプル=====   # -*- encoding:ut…」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Python 組合せと順列の計算==&lt;br /&gt;
[Python]{{category アルゴリズム}}&lt;br /&gt;
===組合せと順列を計算してみる===&lt;br /&gt;
=====サンプル=====&lt;br /&gt;
 # -*- encoding:utf-8 -*-&lt;br /&gt;
 import copy&lt;br /&gt;
 &lt;br /&gt;
 def combination(elem):&lt;br /&gt;
     '''組合せ'''&lt;br /&gt;
     for i,v in enumerate(elem):&lt;br /&gt;
         for v2 in elem[i+1:]:&lt;br /&gt;
             print (v, v2)&lt;br /&gt;
 &lt;br /&gt;
 def permutation(slot,elem, size):&lt;br /&gt;
     '''順列'''&lt;br /&gt;
     if len(elem) == 1:&lt;br /&gt;
         slot[size - 1] = elem[0]&lt;br /&gt;
         print slot&lt;br /&gt;
     else:&lt;br /&gt;
         for i,v in enumerate(elem):&lt;br /&gt;
             slot[size - len(elem)] = v&lt;br /&gt;
             e2 = copy.copy(elem)&lt;br /&gt;
             e2.remove(v)&lt;br /&gt;
             permutation(slot, e2, size)&lt;br /&gt;
     return&lt;br /&gt;
 &lt;br /&gt;
 if  __name__ == '__main__':&lt;br /&gt;
     elem = range(4)&lt;br /&gt;
     slot = [-1 for x in elem]&lt;br /&gt;
 &lt;br /&gt;
     combination(elem)&lt;br /&gt;
     permutation(slot, elem, len(elem))&lt;br /&gt;
     &lt;br /&gt;
=====結果=====&lt;br /&gt;
 (0, 1)&lt;br /&gt;
 (0, 2)&lt;br /&gt;
 (0, 3)&lt;br /&gt;
 (1, 2)&lt;br /&gt;
 (1, 3)&lt;br /&gt;
 (2, 3)&lt;br /&gt;
 [0, 1, 2, 3]&lt;br /&gt;
 [0, 1, 3, 2]&lt;br /&gt;
 [0, 2, 1, 3]&lt;br /&gt;
 [0, 2, 3, 1]&lt;br /&gt;
 [0, 3, 1, 2]&lt;br /&gt;
 [0, 3, 2, 1]&lt;br /&gt;
 [1, 0, 2, 3]&lt;br /&gt;
 [1, 0, 3, 2]&lt;br /&gt;
 [1, 2, 0, 3]&lt;br /&gt;
 [1, 2, 3, 0]&lt;br /&gt;
 [1, 3, 0, 2]&lt;br /&gt;
 [1, 3, 2, 0]&lt;br /&gt;
 [2, 0, 1, 3]&lt;br /&gt;
 [2, 0, 3, 1]&lt;br /&gt;
 [2, 1, 0, 3]&lt;br /&gt;
 [2, 1, 3, 0]&lt;br /&gt;
 [2, 3, 0, 1]&lt;br /&gt;
 [2, 3, 1, 0]&lt;br /&gt;
 [3, 0, 1, 2]&lt;br /&gt;
 [3, 0, 2, 1]&lt;br /&gt;
 [3, 1, 0, 2]&lt;br /&gt;
 [3, 1, 2, 0]&lt;br /&gt;
 [3, 2, 0, 1]&lt;br /&gt;
 [3, 2, 1, 0]&lt;br /&gt;
&lt;br /&gt;
===組み合わせの数===&lt;br /&gt;
 def combi(n ,r):&lt;br /&gt;
     p = 1&lt;br /&gt;
     for i in range(1, r+1):&lt;br /&gt;
         p = p * (n - i + 1) / i&lt;br /&gt;
     return p&lt;br /&gt;
 &lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
     print combi(4, 2)&lt;br /&gt;
==========&lt;br /&gt;
 6&lt;br /&gt;
&lt;br /&gt;
====1行====&lt;br /&gt;
*Pytho3.x では、functioolsのimportが必要、2.7xでは不要&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; from functools import reduce&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; cmb = lambda n,r:reduce(lambda x,y:x*y,range(n,n-r,-1))/reduce(lambda x,y:x*y,range(r,1,-1))&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt; cmb(7,3)&lt;br /&gt;
 35.0&lt;/div&gt;</summary>
		<author><name>Piroto</name></author>
		
	</entry>
</feed>