#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n,m,i,j,c,b;
cin >> n >> m;
bool row=true;
string table[n][m];
if (n<m)
{
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
{
table[i][j] = '-';
}
}
}else{
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
{
table[i][j] = '+';
}
}
}
if (m>n)
{
c=n-(n/2+1);
b=m+c;
row=true;
}else{
c=m-(m/2+1);
b=n+c;
row=false;
}
if(row==true){
for (i = 0; i < c; i++)
{
for (j = 0; j < m; j++)
{
table[i][j]='+';
}
}
}
else{
for (i = 0; i < n; i++)
{
for (j = 0; j < c; j++)
{
table[i][j]='-';
}
}
}
cout << b<<endl;
for (i = 0; i < n; i++)
{
for (j = 0; j < m; j++)
{
cout << table[i][j];
}
cout << endl;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
6 ms |
344 KB |
Output is correct |
4 |
Incorrect |
10 ms |
348 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
52 ms |
1504 KB |
Wrong answer in test 97 21: 107 < 116 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
1876 KB |
Wrong answer in test 24 24: 35 < 44 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
6 ms |
344 KB |
Output is correct |
4 |
Incorrect |
10 ms |
348 KB |
Wrong answer in test 5 29: 31 < 32 |
5 |
Halted |
0 ms |
0 KB |
- |