3 条题解

  • 1
    @ 2023-7-17 10:27:13
    #include <iostream>
    using namespace std;
    
    int main()
    {
        int a,b,c,d,e,f,g;
        cin>>a;
        for(b=1;b<=a;b++){
            for(c=1;c<=a-b;c++){
                cout<<" ";
            }
            for(d=1;d<=2*b-1;d++){
                cout<<"*";
            }
            cout<<endl;
        }
        for(e=1;e<=a-1;e++){
            for(f=e-1;f>=0;f--){
                cout<<" ";
            }
            for(g=2;g<=2*(((a-1)+1)-e);g++){
                cout<<"*";
            }
            cout<<endl;
        }
        return 0;
    }
    

    c++

    • 0
      @ 2023-8-28 11:53:21
      n = int(input())
      for i in range(1, n + 1, 1):
          print(" " * (n - i) + "*" * (i * 2 - 1) + " " * (n - i))
      for i in range(n-1,0,-1):
          print(" " * (n - i) + "*" * (i * 2 - 1) + " " * (n - i))
       
      
      
      • 0
        @ 2022-7-10 20:32:31
        #include<bits/stdc++.h>
        using namespace std;
        int main() {
        	int i,j,b;
        	cin>>b;
        	for(i=1; i<=b; i++) {
        		for(j=1; j<=b-i; j++) {
        			printf(" ");
        		}
        		for(j=1; j<=2*i-1; j++) {
        			printf("*");
        		}
        		printf("\n");
        	}
        	for(i=b-1; i>=1; i--) {
        		for(j=1; j<=b-i; j++) {
        			printf(" ");
        		}
        		for(j=1; j<=2*i-1; j++) {
        			printf("*");
        		}
        		printf("\n");
        	}
        }
        
        • 1

        信息

        ID
        63
        时间
        1000ms
        内存
        128MiB
        难度
        2
        标签
        递交数
        296
        已通过
        187
        上传者