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...
-
Video stabilization example source code. The principle is like that... Firstly, to obtain 2 adjacent images extract good feature to t...
-
Open Source License Commercial Use Guide Understanding Commercial Rights in Open Source Licenses π Legend ✅ Free : Comm...
-
install Claude Code using this shell script . #!/bin/bash # install-claude.sh # Installs Node.js 18+, npm, and Claude Code CLI, handling co...
-
this link is to get down safely. My amazon drive. https://www.amazon.com/clouddrive/share/a3QoYYd7aEUa13wFvhUNBWDQb5h41FFrSotU17jI7s...
-
The latent SVM tells the learning method used in this paper -> "Discriminatively trained deformable part models". The authors s...
-
Visual Studio 2012 Update (at least ver 2, this should be version 4): http://www.microsoft.com/en-us/downlo... Git for Windows: http://git-s...
-
I am wondering that two hog features can compare or not. There was a article about this question on this page -> http://stackoverflow...
-
This article is about hog feature extraction and visualization. Hog feature can computer easy using HOGDescriptor method in opencv. Visu...
-
In past, I wrote an articel about YUV 444, 422, 411 introduction and yuv rgb converting example code. refer to this page -> http://feel...
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;
}