Problem Code: CHFMOT18

i am having time limit exceeded error,can someone pls help
#include
using namespace std;

int main()
{
int t;
int p;
cin>>t;

int s;
int n;

while(t>0)
{
	scanf("%d %d",&s,&n);
	p=0;
	
	if( s==1)
	{
		printf("1");
		printf("\n");
		t--;
		continue;
	}
	
	
	while(s>0 && n>=2)
	{
	    p=p+s/n;
	    s=s%n;
	    n=n-2;
	}
	
	if( s>0)
	{
		p=p+s/1;
	}
	
	
	
	printf("%d",p);
	
	
	t--;
}

return(0);

}

I think your Logic is Correct but implementation is not.

You can have a look at my simple Solution:Click Here

If any part in my code is unclear to you.Do tell me!

thanks a lot!!