Area

In this problem, you will be given a square which has a length of n. Co-ordinates of the square are …

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

Why my program is producing wrong answers in test case 4. plzz hlp

def area(x):
    return x*2 - 4


b = int(input())
for i in range(b):
    c = float(input())
    print(f'Case {i + 1}: {area(c)}')

here c would be an integer number. Not a float type number.

How did you get the formula 2x-4?

here total area=nn…
the area of 4 triangle=4{(n-2)n/21/2}
=n
n-2n
the area of small square=4(1)
=4
now-the required area=(nn) -{(nn-2n)+4}
=2n-4(ans)

I use the formula ,but it give error in case 3;
my code:
#include<stdio.h>
int main()
{
int t,i;
scanf(“%d”,&t);
int a[t];
for(i=0;i<t;i++)
scanf(“%d”,&a[i]);
for(i=0;i<t;i++)
{
int n;
n=a[i];

    printf("Case %d: %d\n",i+1,n*2-4);
}

}
What’s the problem?

There is some kind of problem since it says right answers as wrong answers.