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