i与j

数字三角形

https://ac.nowcoder.com/acm/contest/67628/1015

#include #include #include #define endl '\n' #define buff ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr); using namespace std; int main() {

ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

int n;
cin>>n;
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=i;j++)
	{
		cout<<i;
	}
	cout<<'\n';
}

return 0;

}

#include<iostream>

#include #include #define endl '\n' #define buff ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr); using namespace std; int main() { ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);

int n;
cin>>n;
for(int i=1;i<=n;i++)
{
	for(int j=1;j<=i;j++)
	{
		cout<<j<<" ";
	}
	cout<<'\n';
}

return 0;

}

输入

4 输出 1 1 2 1 2 3 输入 3 输出 1 22 333

全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务