Light oj 1116 - Ekka Dokka Sollution

#include<bits/stdc++.h> using namespace std; int main() { long long int i,j,k,n,T,N,sum,M,W,f,w; map<long long int,long long int> m; cin>>T; for(i=1; i<=T; i++) { k=0; cin>>M; for(j=62;j>=1;j--) // as 2^62 range so all value divided by 2^1 to 2^62 { w=pow(2,j); if(M%w==0) { cout<<"Case "<<i<<": "<<(M/w)<<" "<<w<<endl; k=1; break; } } if(k==0) // k use as flag { cout<<"Case "<<i<<": "<<"Impossible"<<endl; } } return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.