Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
154208 杨启宏 打印菱形 C++ Accepted 2 MS 268 KB 695 2026-05-26 19:38:51

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int i; cin>>i; for(int j=1;j<=i;j++){ for(int m=1;m<=i-j;m++){ cout<<" "; } for(int k=1;k<=2*j-1;k++){ cout<<"*"; } cout<<endl; } for(int j=1;j<=i-1;j++){ for(int m=1;m<=j;m++){ cout<<" "; } for(int k=1;k<=2*(i-1)-(2*j-1);k++){ cout<<"*"; } cout<<endl; } return 0; }