0
已解决
输入两个整数 n 和 m,(0 <= n <= 1000,000,000,0 <= m <= 9),求该整数中数字m的个数。
输入描述 Input Description
输入两个空格隔开的整数n和m。
输出描述 Output Description
输出整数n中数字m的个数。
样例输入 Sample Input
11223 1
样例输出 Sample Output
2
#include<bits/stdc++.h>
using namespace std;
long long n,m,s;
int main()
{
cin>>n>>m;
while(n!=0)
{
if(n%10==m)
s++;
n/=10;
}
cout<<s<<endl;
return 0;
}
0
已采纳
0
0