Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
68133 | 李言 | 放大的X | C++ | 输出格式错误 | 0 | 9 MS | 252 KB | 620 | 2023-02-02 15:56:29 |
#include<bits/stdc++.h> using namespace std; int n,k; void kongge1(int i,int x){ if(i<=x/2+1){ for(int j=1;j<i;j++){ cout<<' '; } }else{ for(int j=1;j<=x-i;j++){ cout<<' '; } } } void kongge2(int i,int x){ if(i<x/2+1){ for(int j=1;j<=x-2*i;j++){ cout<<' '; } }else if(i>x/2+1){ for(int j=1;j<=x-2*(x-i+1);j++){ cout<<' '; } } } void shuchu(int x){ for(int i=1;i<=x;i++){ kongge1(i,x); cout<<'X'; kongge2(i,x); if(i!=x/2+1) cout<<'X'; cout<<endl; } } int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>k; shuchu(k); } return 0; }