Raem's Square

Limits 1s, 512 MB

Raem is an eight years old boy. One day his family was visiting Dhaka Shishu Park near Shahbag . Besides enjoying many games, Raem saw a toy car shop . Raem wanted to purchase a toy car, but the shopkeeper decided to give a chance to Raem. if Raem could give him the correct square of a given number N, then the kind shopkeeper would give the toy free to Raem.


This is a companion discussion topic for the original entry at https://toph.co/p/raem-s-square

Wait is this problem’s test case 100% ok!!!

beacause I have just made an algorithm by pow(num,2) and it generated WA!!!
Where it can’t even be WA at all!!!

I have checked your submission. Test cases are okay. You have to read the problem statement carefully.

Man! we have to just find out the square of a certain number which basically means pow(n,2)…whats the problem then!

@Being_Gorom Sorry about that. Apparently, this problem statement wasn’t written properly. Please check the input specification now.

If you would explain it(i.e. this problem) correctly that would be much helpful since I can’t understand this…

Check your solution with this input:

1
1000000

Update the question statement please. It shows N <= 106 but it was supposed to be 10^6.

1 Like

Thank you for the feedback, @JarifDotTech.

Can you please share a screenshot of where you are seeing this?

This is what is currently published:

I should’ve mentioned… the problem is only in Bengali.

1 Like

Thank you! I should have checked that. Will update it shortly in sha Allah.

#include <stdio.h>
int main(){
    int t,n;
    unsigned long long int out;
    scanf("%d",&t);
    if(1<t && t<1000){
        while(t!=0){
            scanf("%d",&n);
            out=n*n;
            printf("%llu\n",out);
            t--;
        }
    }

}

please check my code and infor me what’s wrong

Even though you are multiplying the number and storing the result in a long long variable. Right when you multiply two integers, the result overflows.

Either change the type of n. Or, cast n to a larger type before multiplying.

1 Like