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)
-
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...
-
I use MOG2 algorithm to background subtraction. The process is resize to small for more fast processing to blur for avoid noise affectio...
-
Created Date : 2009.10. Language : C++ Tool : Visual Studio C++ 2008 Library & Utilized : Point Grey-FlyCapture, Triclops, OpenCV...
-
RTSP(Real Time Streaming Protocol) is video streaming, it usually sent from network camera. VideoCapture function in opencv also can get r...
-
Created Date : 2011.10 Language : C/C++ Tool : Microsoft Visual C++ 2008 Library & Utilized : OpenCV 2.3 Reference : SIFT referenc...
-
After training SVM, we should test the trained XML data is reliable or not.. The method to extract HOG feature is refer to -> http://fe...
-
OpenCV has AdaBoost algorithm function. And gpu version also is provided. For using detection, we prepare the trained xml file. Although...
-
This is example of SVM learning method. This example is I already have explained in past time. See the this page - > http://feelmare.bl...
-
* Introduction - The solution shows panorama image from multi images. The panorama images is processing by real-time stitching algorithm...
-
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...
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;
}