This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;
int main(){
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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |