Skip to content

Instantly share code, notes, and snippets.

@aadimator
Last active November 2, 2016 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aadimator/2293716b7b328cfb9ccd1ccdf7ae7d9d to your computer and use it in GitHub Desktop.
Save aadimator/2293716b7b328cfb9ccd1ccdf7ae7d9d to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main(){
int t;
cin >> t;
for(int a0 = 0; a0 < t; a0++){
int n;
cin >> n;
int count = 0;
int quotient = n;
int remainder = quotient%10;
while (quotient > 9) {
if (remainder != 0 && n%remainder == 0) ++count;
quotient /= 10;
remainder = quotient%10;
}
if (quotient != 0 && n%quotient == 0) ++count;
cout << count << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment