返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int x=0,k,n;
  7. cin>>n>>k;
  8. for(int i=n;i>0;i--)
  9. {
  10. if(i%k==0 || (i-k)%10==0)
  11.     x++;      
  12. }else if(9)
  13. cout<<x;
  14.   system("pause");     
  15.   return 0;   
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int x=0,k,n;
  7. cin>>n>>k;
  8. for(int i=n;i>0;i--)
  9. {
  10. if(i%k==0 || (i-k)%10==0 || i/10==k)
  11. {
  12.     x++;
  13. }     
  14. }
  15. cout<<x;

  16.   system("pause");     
  17.   return 0;   
  18. }
複製代碼

TOP

返回列表