题解 | #涂小天与他的画#

涂小天与他的画

https://ac.nowcoder.com/acm/problem/214218

   #include<iostream>
   #include<cmath>
   using namespace std;
   int main ()
    {
    int t;
     cin>>t;
  while (t--){
    int n;
      cin>>n;
    int cx=n/2,cy=n/2;
     for (int i=0;i<n;i++)
      {
     for (int j=0;j<n;j++)
     if (abs(i-cx)+abs(j-cy)<=n/2)
       cout <<'*';
        else cout << ' ';
         cout<<endl;
           }
         }
          return 0;
        }
全部评论

相关推荐

飞屋一号:实话实说就行,先争取一下能不能线上,不行就直接放弃,付出与回报不成正比
我的求职进度条
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务