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)
-
* Introduction - The solution shows panorama image from multi images. The panorama images is processing by real-time stitching algorithm...
-
Logistic Classifier The logistic classifier is similar to equation of the plane. W is weight vector, X is input vector and y is output...
-
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...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
This is example source cod of ORB_GPU feature detection and matching. ORB feature is known extraction speed is faster than surf and sift. ...
-
OpenCV has AdaBoost algorithm function. And gpu version also is provided. For using detection, we prepare the trained xml file. Although...
-
In past, I wrote an articel about YUV 444, 422, 411 introduction and yuv rgb converting example code. refer to this page -> http://feel...
-
1. load pre-trained model 2. export onnx 3. load onnx refer to code: . import warnings from torch . jit import TracerWarning warnings . ...
-
refer to code: . import mlflow from sklearn . metrics import adjusted_rand_score , silhouette_score from sklearn . cluster import K...
-
Created Date : 2007.8 Language : Matlab / C++(MFC) Tool : Matlab / Visual C++ 6.0 Library & Utilized : - / OpenGL Reference : ...
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;
}