Algorithm with Problem Solving
#include <cstdio> int bitCount(int n){ int r = 0; while(n > 0){ r += n%2; n /= 2; } return r; } int main(){ int n; scanf("%d", &n); puts(bitCount(n)==1?"1":"0"); return 0; }
댓글 쓰기
댓글 없음:
댓글 쓰기