Skip to content

Instantly share code, notes, and snippets.

@Nahiduzzaman
Last active February 12, 2016 16:37
Show Gist options
  • Save Nahiduzzaman/88d473ef39fcdb8eebbe to your computer and use it in GitHub Desktop.
Save Nahiduzzaman/88d473ef39fcdb8eebbe to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main()
{
int t,i=0;
unsigned long long int w;
scanf("%llu",&t);
//for(int i = 0 ; i < t;i++)
while(t--)
{
scanf("%llu",&w);
unsigned long long int odd = 1, even = 2;
if(w%2 == 0)
{
while(w != even*odd){
if(w%even == 0){
odd = w/even;
if(odd%2 == 0)
{
even += 2;
}
}
else {
even += 2;
}
}
printf("Case %d: %llu %llu\n",i+1, odd, even);
}
else
{
printf("Case %d: Impossible\n",i+1);
}
i++;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment