What does it mean by test case?

what does it mean by test case? how to use it? how to take care about the test case?

for example in this question the the constraints are given. so please help me understand this constraints term. how to use? how to consider it while coding for this challenge so that i may not get any rejection… please elaborate the term constraints…

hello @Anku47

image

first read input format.
here they are saying first u will be given a number t (which is number of test cases).

so u need to run ur logic t times.
and in each iteration u need to read new number n and print ur answer accordingly.

in above situation ur code should look like->


int t;
cin>>t; // read t 

for(int i=1;i<=t;i++){  // read t new numbers and print answer accordingly

int n;
cin>>n;

cout<<answer using ur logic<<"\n";

}

contrainst are range of values that a particular variable can take.
for example -> in this problem t can take value in range [1…15]
and n can take values upto 10^9

it means that we can use only int here. there is no need to use long long int…am i correct sir???

yeah … . . . int will work fine becuase value of n is in integer range.

do chekc this ->link

thank you sir. as n is given in the range 10^9 so which data type should i use?

for n use int ,
but in ur algorithm if u r using any calculation of type (n * n ) then use long long to avoid overflow

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.