100 Accepted
# | 状态 分数 | 耗时 | 内存占用 |
---|---|---|---|
#1 | Accepted 20 | 3ms | 324 KiB |
#2 | Accepted 20 | 3ms | 320 KiB |
#3 | Accepted 20 | 3ms | 324 KiB |
#4 | Accepted 20 | 3ms | 536 KiB |
#5 | Accepted 20 | 3ms | 536 KiB |
代码
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,h=1;//h用来计数
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(h/10==0){
cout<<0<<h;
}//判断是一位数还是两位数
else{
cout<<h;
}
h++;//计数器加一
}
cout<<endl;//换行
}//打印正方形
cout<<endl;
h=1;//回到一开始计数
for(int i=1;i<=n;i++){
for(int j=i;j<n;j++){
cout<<" ";
}//打印空格
for(int j=1;j<=i;j++){
if(h/10==0){
cout<<0<<h;
}else{
cout<<h;
}
h++;
}
cout<<endl;
}//打印三角形
return 0;
}
信息
- 递交者
- 题目
- J0061 【深基4.习8】求三角形
- 语言
- C++11
- 代码长度
- 526 Bytes
- 递交时间
- 2024-5-1 16:42:32
- 评测时间
- 2024-5-1 16:42:34
- 分数
- 100
- 总耗时
- 14ms
- 峰值时间
- 3ms
- 峰值内存
- 536 KiB