Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
307978 黄浙峰老师 【C4-T】鲜花方阵 C++ 通过 100 1 MS 276 KB 601 2025-01-05 09:58:08

Tests(1/1):


#include<bits/stdc++.h> using namespace std; int a[500][500]; int main(){ int n,m; cin>>n; m=n/2+1; for(int i=1;i<=m;i++){ for(int j=1;j<=m;j++){ if(i+j==m+1){ a[i][j]=0; a[i+m-1][j+m-1]=0; }else{ a[i][j]=1; a[i+m-1][j+m-1]=1; } } } for(int i=1;i<=m;i++){ for(int j=1;j<=m;j++){ if(i==j){ a[i][j+m-1]=0; a[i+m-1][j]=0; }else{ a[i][j+m-1]=1; a[i+m-1][j]=1; } } } a[m][m]=0; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cout<<setw(3)<<a[i][j]; } cout<<endl; } return 0; }


测评信息: