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)
-
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...
-
In past, I wrote an articel about YUV 444, 422, 411 introduction and yuv rgb converting example code. refer to this page -> http://feel...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
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...
-
To install the language pack for vs 2013, it made things worse. The error message "window program compatibility mode is on. turn i...
-
error: . VanillaPipeline.get_train_loss_dict: 12.6875 Traceback (most recent call last): File "/home/mare/anaconda3...
-
Created Date : 2011.8 Language : Matlab Tool : Matlab 2010 Library & Utilized : - Reference : Multiple View Geometry (Hartly and Z...
-
refer to code: . import cv2 # Load an image img = cv2 . imread ( 'input_image.jpg' , cv2 . IMREAD_GRAYSCALE ) # Apply Canny edge ...
-
EMD(earth mover distance) method is very good method to compare image similarity. But processing time is slow. For using the EMD compare, ...
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;
}