返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. bool check(int x,int k)
  5. {
  6.     if(x%k==0)
  7.     {
  8.         return true;
  9.     }else{
  10.         while(x>0)
  11.         {     
  12.             if(x/10==k)
  13.                 return true;
  14.             x/=10;   
  15.         }
  16.     }
  17. }
  18. int main()
  19. {
  20.     int x,k;
  21.     cin>>x>>k;
  22.     cout<<check(x,k);
  23.     system("pause");     
  24.     return 0;   
  25. }
複製代碼

TOP

返回列表