Wrong answer in Digital clock

I want to know in which case its failing .

question link:

Below is my logic:

#include<iostream>
#include<cstdio>
#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(NULL);


using namespace std;

int main()
{
	FAST_IO
int HH[19]={0,1,2,3,4,5,6,7,8,9,11,22,33,44,55,66,77,88,99};
int T,H,M;
cin>>T;
while(T--)
{
	cin>>H>>M;
unsigned int count=0;
for(int i=1;i<19;i++)
{
if(HH[i]<10)
{
	if(HH[i]<H && (HH[i]*11)<M)
		count=count+2;
	else if((HH[i]<H && (HH[i]*11)>=M))
		{
			count=count+1;
		   
		}
}
else
{
	if(HH[i]<H  && ((HH[i]/11)*11)<M)
		count=count+2;
	else if((HH[i]<H ))
		count=count+1;
}

}


if(HH[0]<H && HH[0]<M)
		count=count+1;
		
		cout<<count<<"\n";
}



    return 0;
}



He solved it.

1 Like