#33299: ans


yp11151103@yphs.tp.edu.tw (810-29洪宥維)

學校 : 臺北市私立延平高級中學
編號 : 197208
來源 : [203.72.178.1]
最後登入時間 :
2023-06-17 13:49:24
b330. NOIP2013 1.记数问题 -- NOIP2013普及组第一题 | From: [203.72.178.1] | 發表日期 : 2022-12-21 17:14

//b330
#include<iostream>
using namespace std;
int main(){
int n,x;
while(cin>>n>>x){
    int ans=0;
    for(int i=1;i<=n;i++){
        int temp=i;
        while(temp){ //只有0是FLASE其他的繼續執行 
            if(temp%10==x) ans++;
            temp/=10;
        }
    }
    cout<<ans<<endl;
}
    return 0;
}

 
ZeroJudge Forum