</p> <h1>include</h1> <p>using namespace std; int main() { int n; // 菱形最长行的<em>的个数为n,且n一定为奇数因为 n = 2</em>k + 1 cin &gt;&gt; n;</p> <pre><code>int cn = 1; bool isUp = true; for (int i = 1;i { for (int j = 1; j { cout &amp;lt;&amp;lt; &amp;quot; &amp;quot;; } for (int j = 1; j { cout &amp;lt;&amp;lt; &amp;quot;*&amp;quot;; } for (int j = 1; j { cout &amp;lt;&amp;lt; &amp;quot; &amp;quot;; } cout &amp;lt;&amp;lt; endl; if (cn &amp;gt;= n) { isUp = false; } if (isUp) { cn += 2; } else { cn -= 2; } } return 0; </code></pre> <p>}