#37211: c++迴圈


mu0975353917@gmail.com (Moon Chan)

學校 : 國立雲林科技大學
編號 : 188583
來源 : [36.235.76.179]
最後登入時間 :
2024-04-18 19:12:04
c013. 00488 - Triangle Wave -- UVa488 | From: [36.235.64.193] | 發表日期 : 2023-08-25 14:36

#include<bits/stdc++.h>
using namespace std; 
 
int main()
{
int a;
cin>>a;
cin.get();
for(int i=0;i<a;i++)
{
int b,c;
cin>>b>>c;
for(int j=0;j<c;j++)
{
for(int k=1;k<b+1;k++)
{
for(int u=0;u<k;u++)
{
cout<<k;
}
cout<<endl;
}
for(int k=b-1;k>0;k--)
{
for(int u=0;u<k;u++)
{
cout<<k;
}
cout<<endl;
}
cout<<endl;
}
}
}
 
ZeroJudge Forum