Topper Rama Rao
Below given code is for hlp_rams spoj or Topper Rama Rao
you can Read This for understanding what is logic behind this.#include <stdio.h> #include <iostream> #include <cmath> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { long long num,odd=1,temp; scanf("%lld",&num); int i; if(num==0) printf("0 1\n"); else{ odd=1; temp=num; while(temp) { odd*=((temp & 1)+1); temp=temp>>1; } printf("%lld %lld\n",num+1-odd,odd); } } return 0; }
No comments:
Post a Comment
Your comment is valuable to us