TOPIC

Wrong Answer (5%).....But why?

Rezaul Karim asked 2 years ago

include <bits/stdc++.h>

using namespace std;

int main() { long int A,B; long long int C=0; int N,len1,len2; stringstream Str1,Str2;

cin>>N;
while(N--)
{
    cin>>A>>B;

    Str1<<A;
    Str2<<B;
    len1 = Str1.str().size();
    len2 = Str2.str().size();

    if(len2==2)
    {
        C = pow(10,len2)+1;
        C=A%C;

        if(B==C)
            cout<<"encaixa"<<endl;
        else
            cout<<"nao encaixa"<<endl;

    }

    else if(len1>=len2)
    {
        C = pow(10,len2);
        C=A%C;

        if(B==C)
            cout<<"encaixa"<<endl;
        else
            cout<<"nao encaixa"<<endl;
    }

    else
    {
        cout<<"nao encaixa"<<endl;
    }

}

return 0;

}

This topic was solved and cannot recieve new replies.