Yet Another Meme Problem

mail@pastecode.io avatar
unknown
plain_text
2 years ago
550 B
0
Indexable
Never
#include <stdio.h>

int main(void){
    long long int A,B,m,X,n;
    int T;

    scanf("%d",&T);
    for(int t=0;t<T;t++){
        n=0;
        scanf("%lld %lld",&A,&B);
        for(long long int a=1;a<=A;a++){
            for(long long int b=1;b<=B;b++){
               m=b/10+1;
               X=a;
               for(long long int i=0;i<m;i++){
                   X=X*10;
               }
               X=X+b;
               if((a*b+a+b)==X) n++;
            }
        }
        printf("%lld\n",n);
    }

    return 0;
}