top1编程
← 返回题目
题解

【入门】放大的Z

1 条题解

  • 0
    @ 2026-7-28 22:09:30
    #include <iostream>
    using namespace std;
    
    int main(){
    	int i,j,n;
    	cin>>n;
    	for(i = 1;i <= n;i++){
    		if(i == 1 || i == n){
    			for(j = 1;j <= n;j++) cout<<"*"; 
    		}else{
    			for(j = 1;j <= n - i;j++) cout<<" ";
    			cout<<"*";
    		}
    		
    		cout<<endl;
    	}
    }
    
    • 1