Initiate Luogu
This commit is contained in:
18
Luogu/P1980 [NOIP 2013 普及组] 计数问题.cpp
Normal file
18
Luogu/P1980 [NOIP 2013 普及组] 计数问题.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
//using namespace std;
|
||||
int main(){
|
||||
int a;
|
||||
char b;
|
||||
scanf("%d %c",&a,&b);
|
||||
char tmp[10]="";
|
||||
int js=0;
|
||||
for(int i=1;i<=a;i++){
|
||||
sprintf(tmp,"%d",i);
|
||||
for(int j=0;j<strlen(tmp);j++){
|
||||
if(tmp[j]==b) js++;
|
||||
}
|
||||
}
|
||||
printf("%d",js);
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user