- 分享
- @ 2026-09-11 18:44:37
马上GESP考级了,我关于怎么画菱形的知识不是很擅长,求大佬路过给我讲解一点攻略
2 条评论
-
202607zj09王宇浩 (王宇浩) LV 8 @ 2026-09-11 20:36:46
也可以用曼哈顿距离做
-
@ 2026-09-11 20:35:33
#include <bits/stdc++.h> using namespace std; int n; int main() { cin>>n; for (int i=1;i<=2*n-1;i++) { for (int j=1;j<=2*n-1;j++) { if (i+j-1==n || i+j+1==3*n || 2*n-i+j-1==n || 2*n-j+i-1==n) cout<<"+"; else cout<<"."; } cout<<endl; } return 0; }
- 1