Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
109197 | 胡海峰老师 | 打印菱形 | C++ | Accepted | 2 MS | 272 KB | 431 | 2025-02-06 13:58:51 |
#include <iostream> using namespace std; int main(){ int n; cin>>n; for( int j=1;j<=n;j++) { for(int t=1;t<=n-j;t++) cout<<" "; for(int t=1;t<=2*j-1;t++) cout<<"*"; cout<<endl; } for( int j=1;j<n;j++) { for(int t=1;t<=j;t++) cout<<" "; for(int t=1;t<=-2*j + 2*n-1;t++) cout<<"*"; // y = ax + b (1,5) - (2,3) cout<<endl; } return 0; }