1 solutions

  • 0
    @ 2024-1-4 21:40:19
    #include <iostream>
    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
    	char a = '*';
    	int n;
    	cin >> n;
    	for(int i = 1 ;i <= n ;i++){
    		int jian = i-1;
    		for(int j = 1 ;j <= 3*(2*n-1) ;j++){
    			if(j >= n - jian && j <= n + jian){
    				cout << a;
    			}else if(j >= 3*n - 1 - jian && j <= 3*n - 1 + jian){
    				cout << a;
    			}else if(j >= 5*n - 2 - jian && j <= 5*n - 2 + jian){
    				cout << a;
    			}else{
    				cout << " ";
    			}
    		}
    	    cout << endl;
    	}
    	return 0;
    }
    
    • 1

    Information

    ID
    387
    Time
    1000ms
    Memory
    16MiB
    Difficulty
    8
    Tags
    # Submissions
    15
    Accepted
    5
    Uploaded By