Find Digits
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
void cunt_digit(LL num)
{
LL cnt=0,tmp = num;
while(num)
{
LL kp=(num%10);
if(kp)
{
if(!(tmp % kp))
{
cnt++;
}
}
num/=10;
}
cout << cnt << "\n";
}
int main()
{
int t;
cin >> t;
while(t--)
{
LL n;
cin >> n;
cunt_digit(n);
}
return 0;
}
using namespace std;
typedef long long LL;
void cunt_digit(LL num)
{
LL cnt=0,tmp = num;
while(num)
{
LL kp=(num%10);
if(kp)
{
if(!(tmp % kp))
{
cnt++;
}
}
num/=10;
}
cout << cnt << "\n";
}
int main()
{
int t;
cin >> t;
while(t--)
{
LL n;
cin >> n;
cunt_digit(n);
}
return 0;
}
Comments
Post a Comment