UVA488 :https://uva.onlinejudge.org/external/4/488.pdf
/*easy */
#include<iostream>
using namespace std;
int n = 0,A = 0,F = 0,blank=1;
int main(void) {
cin >> n;
while(n--)
{
cin >> A >> F;
for (int f = 0; f < F; f++)
{
int i = 1, j = 1;
if (blank == 0)cout << endl;
for (i = 1; i <= A; i++)
{
for (j = 1; j <= i; j++)
{
cout << i;
}
cout << endl;
}
for (i = A - 1; i >= 1; i--)
{
for (int j = i; j >= 1; j--)
{
cout << i ;
}
cout << endl;
}
blank = 0;
}
}
system("PAUSE");
}
/*easy */
#include<iostream>
using namespace std;
int n = 0,A = 0,F = 0,blank=1;
int main(void) {
cin >> n;
while(n--)
{
cin >> A >> F;
for (int f = 0; f < F; f++)
{
int i = 1, j = 1;
if (blank == 0)cout << endl;
for (i = 1; i <= A; i++)
{
for (j = 1; j <= i; j++)
{
cout << i;
}
cout << endl;
}
for (i = A - 1; i >= 1; i--)
{
for (int j = i; j >= 1; j--)
{
cout << i ;
}
cout << endl;
}
blank = 0;
}
}
system("PAUSE");
}
留言
張貼留言