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)
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
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...
-
Background subtractor example souce code. OpenCV support about 3 types subtraction algorithm. Those are MOG, MOG2, GMG algorithms. Det...
-
Created Date : 2009.10. Language : C++ Tool : Visual Studio C++ 2008 Library & Utilized : Point Grey-FlyCapture, Triclops, OpenCV...
-
This is data acquisition source code of LMS511(SICK co.) Source code is made by MFC(vs 2008). The sensor is communicated by TCP/IP. ...
-
Created Date : 2011.10 Language : C/C++ Tool : Microsoft Visual C++ 2008 Library & Utilized : OpenCV 2.3 Reference : SIFT referenc...
-
The MNIST dataset is a dataset of handwritten digits, comprising 60 000 training examples and 10 000 test examples. The dataset can be downl...
-
* Introduction - The solution shows panorama image from multi images. The panorama images is processing by real-time stitching algorithm...
-
OpenCV has AdaBoost algorithm function. And gpu version also is provided. For using detection, we prepare the trained xml file. Although...
-
yolo v5 data coordinate format ex) str_v = "32 0.262 0.7878 0.314 0.385" #read image cvmat = cv2.imread(img_path) #get height, w...
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;
}