int FindCount(int n){

if(n<3){
return n;
}

if(n>=3 && n<10){
return (n-1);
}

int po=1;

while(n/po>9){
po*=10;
}

int msd=n/po;

if(msd==3){
return FindCount(3*(po)-1);
}else{
return (FindCount(msd)*FindCount(po-1)+FindCount(msd)+FindCount(n% (po) ));
}


}
int count_word_in_str_way_1(char *str, char *word){
	//init checking
	if (str == NULL || word == NULL) return NULL;

	int count = 0;
	FindCount(word, str, &count);
	return count;
}
예제 #3
0
int main(){


char str[]="One two          three\n  four\nfive  ";

printf("\nNo of words : %d",FindCount(str));


return 0;
}
int main(){

int n=578;

printf("\nCount of numbers from 1 to %d that dont contains 3 : %d",n,FindCount(n));







return 0;
}
int FindPair2(int* X,int n,int* Y ,int m){

int YCountHelper[5];

int j;

for(j=0;j<5;j++){
YCountHelper[j]=0;
}

int i;

for(i=0;i<m;i++){
if(Y[i]<5){
YCountHelper[Y[i]]++;
}
}

/*
printf("\nY count\n");

for(j=0;j<5;j++){
printf("%d  ",YCountHelper[j]);
}
getch();
*/

QuickSort(Y,0,m-1);
/*
for(i=0;i<m;i++){
printf("%d  ",Y[i]);
}
getch();
*/

int count=0;

for(i=0;i<n;i++){
count+=FindCount(X[i],Y,m,YCountHelper);
}

return count;
}