Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|---|
68135 | 李言 | 放大的X | C++ | Accepted | 100 | 8 MS | 252 KB | 635 | 2023-02-02 15:57:04 |
#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); cout<<endl; } return 0; }