Skip to content

Commit

Permalink
New Problem- Solution Accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
armurox committed Oct 27, 2023
1 parent 866d3ec commit 5012954
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions crossmarket/cross.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <stdio.h>

int main()
{
int t;
scanf("%d", &t);
for (int i = 0; i < t; i++)
{
int n, m;
scanf("%d%d", &n, &m);
if (m < n)
{
printf("%d\n", n + (2 * m) - 2);
}

else if (m == n && m == 1)
{
printf("%d\n", 0);
}

else
{
printf("%d\n", m + (2 * n) - 2);
}
}
}

0 comments on commit 5012954

Please sign in to comment.