본문 바로가기

한 줄에 여러개의 숫자를 입력받아 배열에 할당

by 식 2009. 7. 13.
#include <stdio.h>
void Depet(int num,int &count,int &zero,int n)
{
	if(--n>0)
		Depet(num/2,count,zero,n);
	if(zero==3){
			n=-1;
			return;
	}
	if(num%2==0){
		if(++zero==3){
			count++;
		}
	}
	else
		zero=0;
}

void main()
{
	int i,count=0,zero;
	for(i=0;i<=255;i++){
		zero=0;
		Depet(i,count,zero,8);
	}
	printf("%d\n",256-count);
}

반응형

'' 카테고리의 다른 글

02. 커널 오브젝트 下  (0) 2009.08.18
01. 커널 오브젝트 上  (0) 2009.08.18
문자열 거꾸로 출력하기  (0) 2009.07.13
2. 메시지  (0) 2009.07.12
1. API 기본소스  (0) 2009.07.12