Logic right still being considered wrong

DIGARR Moengage 02-04-2022 Contest

Hello everyone this is my very first post on discuss last time in a Cook Off (i.e Moengage on 02-04-2022) one I made this program everything seems right from logic to syntax and even time still it is being considered wrong.

#include <stdio.h>

int main()
{
	int t, n, l, d;
	scanf("%d", &t);
	for(int i=1;i<=t;i++)
	{
		scanf("%d", &l);
		scanf("%d", &n);
		while(n!=0)
		{
			d=n%10;
			if(d==5||d==0)
			{
				printf("Yes\n");
				l=0;
				break;
			}
			n=n/10;
		}
		if(l!=0)
			printf("No\n");
	}
	return 0;
}

Hey @codernakul :smiling_face: ,
Thank you for posting your doubt , your logic is correct only issue is with the input remember constraints for N <= 10^1000 which cannot be stored in a int data type (also not in long long int ) so you just have to take a string there and do same stuff it will run fine.

Oh yes! Thank You for looking into my issue I will keep the test cases in mind from next time.

1 Like