2009/금//ACM2453/ ¶
- 78, 83 1 ..;; 고겠
#include <iostream> int main(){ int input, i=2, b=1, count=0, temp = 0; scanf("%d", &input); if(input == 0) return 0; temp = input; while(1){ if(input%2 == 1) break; temp >>= 1; if(temp %2 == 1) break; b++; } printf("b = %d, i = %d\n", b, i); printf("temp : %d\n", temp); for(;1;count++, temp >>= 1) if(temp %2 == 0) break; printf("count : %d\n", count); input = ((input >> b+count) + 1); input <<= b+1; for(i=0; i<count-b; i++){ input <<= 1; input++; } printf("output : %d\n", input); }