经典简约
清爽简洁,回归本真
液态水晶
毛玻璃+霓虹光带
赛博朋克
霓虹故障艺术风
🚫
违规操作检测
禁止使用右键菜单
⚠️ 此操作已被系统记录
1

the snake

📝 题解 🔵 仅限 C++
题目描述
<p><span style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;">在n*n方陈里填入1,2,...,n*n,要求填成蛇形。例如n=4时方陈为:</span><br style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;" /> <span style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;">10 11 12 1</span><br style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;" /> <span style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;">9 16 13 2</span><br style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;" /> <span style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;">8 15 14 3</span><br style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;" /> <span style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;">7 6 5 4</span></p> <p></p>
输入格式
<p>直接输入方陈的维数,即n的值。(n&lt;=100)</p> <p></p>
输出格式
<p><span style="color: rgb(70, 70, 70); font-family: Tahoma, Arial, sans-serif, simsun; font-size: 14px; line-height: 16.8px;">输出结果是蛇形方陈。</span></p> <p></p>
样例
样例输入 1
3
样例输出 1
7 8 1 6 9 2 5 4 3
提交代码
请先登录后提交

🤖 AI 解题助手

DeepSeek
就绪
👋 你好!我是 AI 解题助手。
我已阅读了这道题,可以帮你分析思路、提供代码示例。
⚠️ 请先登录后使用