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
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);}}