Editorial for Цифри


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.
by:

Тестовете можете да видите тук.

Примерно решение на C++:

#include <iostream>
using namespace std;
int main()
{
   int a, b, p1, p2, br=0;
   int i, x, c;
   cin>>a>>b>>p1>>p2;
   for (i=a; i<=b; i++)
   {
       x=i;
       while (x!=0)
             {
              c=x%10;
              if (c%p1!=0 && c%p2!=0) br++;
              x=x/10;
             }
   }
   cout<<br<<endl;

   return 0;
}

Comments

There are no comments at the moment.