8/29/2011
f(N) counts number of '1'. For example f(13) = 6. So f(1)=1. What next number do satisfy the rule?
f(N) counts number of '1'. For example f(13) = 6. So f(1)=1. What next number do satisfy the rule?
---------------------------------------------------
์์ n์ ๋ํด์ 1๊ณผ n ์ฌ์ด์ 1์ด ๋์ค๋ ํ์๋ฅผ ๋ํ๋ด๋ ํจ์๋ฅผ f(n)์ด๋ผ๊ณ ํ๋ค. ์๋ฅผ ๋ค์ด f(13)=6์ด๋ค. f(n)=n์ด ๋๋ ์ฒซ๋ฒ์งธ ์์๋ 1์ด๋ค. ๋๋ฒ์งธ ์์๋ ๋ฌด์์ธ๊ฐ?
Subscribe to:
Post Comments (Atom)
-
Logistic Classifier The logistic classifier is similar to equation of the plane. W is weight vector, X is input vector and y is output...
-
As you can see in the following video, I created a class that stitching n cameras in real time. https://www.youtube.com/user/feelmare/sear...
-
fig 1. Left: set 4 points (Left Top, Right Top, Right Bottom, Left Bottom), right:warped image to (0,0) (300,0), (300,300), (0,300) Fi...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
* Introduction - The solution shows panorama image from multi images. The panorama images is processing by real-time stitching algorithm...
-
Created Date : 2011.10 Language : C/C++ Tool : Microsoft Visual C++ 2008 Library & Utilized : OpenCV 2.3 Reference : SIFT referenc...
-
OpenCV has AdaBoost algorithm function. And gpu version also is provided. For using detection, we prepare the trained xml file. Although...
-
In the YUV color format, Y is bright information, U is blue color area, V is red color area. Show the below picture. The picture is u-v col...
-
simply check below code and example result. . def image_grid ( imgs , rows , cols ): assert len ( imgs ) == rows * cols w , h...
-
I once wrote the following article. http://study.marearts.com/2014/04/opencv-study-mat-point-access-method.html This article is a sample c...
This is my code.
ReplyDeleteLet's compare to each code.
Bye Bye~ ^^
int CountOne(int input)
{
int count =0;
while(1)
{
if( input%10 == 1)
count++;
input = input/10;
if(input == 0)
break;
}
return count;
}
int main()
{
int i=2;
int count=1;
while(1)
{
count += CountOne(i);
if( i == count)
break;
i=i+1;
}
printf("f(%d) = %d\n", i, count);
return 0;
}
JeKang's code:
ReplyDelete#include
void main()
{
unsigned long Num, End, Temp;
Num=0;
End=0;
while(Num<=1 || Num!=End){
Num+=1;
Temp=Num;
while(Temp!=0){
if(Temp%10==1) End+=1;
Temp=(unsigned long)(Temp/10);
}
}
printf("์ ๋ ฅ๊ฐ Num = %d\n๊ฒฐ๊ณผ๊ฐ End = %d\n",Num,End);
}
์ ๊ฐ์ ์์ค ์ ์งฐ๋ค..
ReplyDelete๋ด๊ฐ ๋ณผ๋๋, while๋ฌธ ์กฐ๊ฑด์ด ์กฐ๊ธ ๋ณต์กํด์ ๋์ค์ ๋ณด๋ฉด ์ดํด๊ฐ ์ฝ๊ฒ ์๊ฐ ๊ฒ ๊ฐ๊ณ ..
while๋ฌธ ์์ while๋ฌธ์ ํน์ ์ผ๋ง ํ๋๊น ํจ์๋ก ๋ง๋ค๋ฉด ์์ค๊ฐ ๋ ๊ฐ๊ฒฐํด ์ง ๊ฒ ๊ฐ๋ค.
์ํ๋ค..
Good job~!!
JeKang :
ReplyDelete๋ค ํจ์๋ก๋ ๋ง๋ค์ด ๋ณผ๊ป์. ๊ฐ์ฌํฉ๋๋ค~
๋ฏผํ๊ท
ReplyDelete#include
#include
int fun(char* a);
void main()
{
int d;
int p=0;
int i=0;
char a[20]={0,};
printf("์ซ์์ ๋ ฅํ์ธ์:");
scanf("%d",&d);
for(i=0;i<=d;i++)
{
itoa(i,a,10);
p=p+fun(a);
if(p==i)
printf("%d\n",p);
}
}
int fun(char* a)
{
int i=0;
int count=0;
for(i=0;i<= 20 ;i++)
{
if(a[i]=='1') count+=1;
}
return count;
}