题解:P5721 【深基4.例6】数字直角三角形
P5721 【深基4.例6】数字直角三角形
思路
首先可以知道要输出的是一个第一行为
Code
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int c=1;
for (int i=n;i>=1;i--){
for (int j=1;j<=i;j++){
if (c<10){
cout<<"0"<<c;
}
else{
cout<<c;
}
c++;
}
cout<<endl;
}
return 0;
}