U E D R , A S I H C RSS

An Easy Problem/김태진

Status

Problem 2453Userjereneal20
Memory388KTime125MS
LanguageGCCResultAccepted

Idea

  • . 1 for , 1 1 .

Source Code

#include <stdio.h>

int bincount(int X);

int main()
{
    int N,n,k=0;
    while(1){
        scanf("%d",&N);
        if(N==0) break;
        k=bincount(N);
        for(n=N+1;k!=bincount(n);n++){}
        printf("%d\n",n);
    }
    return 0;
}

int bincount(int X)
{
    int nf,kf=0;
    for(nf=X;nf>0;nf=nf>>1){
        if(nf%2==1) kf++;
    }
    return kf;
}

Trial and error

  • ! 하 . .. 10 2 !! -- 한 힌트 . 한 accept! 198B , -ㅎㅎㅎ
    • accept -. ㅋㅋㅋㅋ ㅠㅠ A1B3C1A2 3 ... -
      • 크해 accept. ( --) .. = -

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:22:28
Processing time 0.0183 sec