抄袭的网站,wordpress 导入分类,凡科建站登录,科技打破垄断全球的霸权题目描述 试计算在区间 1 到 n 的所有整数中#xff0c;数字 x#xff08;0≤x≤9#xff09;共出现了多少次#xff1f;例如#xff0c;在 1 到 11 中#xff0c;即在 1,2,3,4,5,6,7,8,9,10,11 中#xff0c;数字 1 出现了 4 次。
输入格式 2 个整数 n,x#xff0c;之…题目描述 试计算在区间 1 到 n 的所有整数中数字 x0≤x≤9共出现了多少次例如在 1 到 11 中即在 1,2,3,4,5,6,7,8,9,10,11 中数字 1 出现了 4 次。
输入格式 2 个整数 n,x之间用一个空格隔开。
输出格式 1 个整数表示 x 出现的次数。
样例 #1 样例输入 #1 11 1 样例输出 #1 4 提示 对于 100% 的数据1≤n≤1060≤x≤9。
#includebits/stdc.h
using namespace std;
int n,m;
int main(){cinnm;int ans0;for(int i1;in;i){int ji;while(j0){int aj%10;j/10;if(am){ans; }}}coutans;return 0;
}