More actions
imported>joojis No edit summary |
imported>Kesarr No edit summary |
||
| Line 40: | Line 40: | ||
** 담문제부턴 기억나면 체크해두도록 하지... 이건 기억이 안난다 아마 문제해석부터 처음 Accept까지 30분 조금 안됐을거임. 코드 줄이는건 짬짬이 해서 잘 모르겠당 -[[정진경]] | ** 담문제부턴 기억나면 체크해두도록 하지... 이건 기억이 안난다 아마 문제해석부터 처음 Accept까지 30분 조금 안됐을거임. 코드 줄이는건 짬짬이 해서 잘 모르겠당 -[[정진경]] | ||
** joojis이(가) Kesarr을(를) 이겼다! | ** joojis이(가) Kesarr을(를) 이겼다! | ||
** 앗~ 이건 뭔가요?ㅋㅋㅋ - [[변형진]] | |||
Revision as of 16:00, 16 June 2011
Describe AnEasyProblem/정진경 here
Source Code
main(n,a,b){for(;a=b=scanf("%d",&n),n;printf("%d\n",n+a*b-b/2)){for(;a&~n;a*=2);for(;(b|a*b)&n;n+=b-a*b,b*=2);}}
// 164K 0MS C 112B
(define (mod a b)
(if (< a b)
a
(mod(- a b) b)
)
)
(define (quot a b)
(/ (- a (mod a b)) b)
)
(define (BitCount n)
(if (< n 1)
0
(+ (BitCount (quot n 2)) (mod n 2))
)
)
(define (SearchBitN n m)
(if (= n (BitCount m))
m
(SearchBitN n (+ m 1))
)
)
(define (AnEasyProblem n)
(SearchBitN (BitCount n) (+ n 1))
)