Skip to content

Instantly share code, notes, and snippets.

@zsrinivas
Created May 26, 2014 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsrinivas/a40658df27cc2c98d616 to your computer and use it in GitHub Desktop.
Save zsrinivas/a40658df27cc2c98d616 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <assert.h>
#include <ctype.h>
int main(int argc, char const *argv[])
{
int testc,ans,t,years,extrac;
scanf("%d", &testc);
while(testc--)
{
scanf("%d", &t);
years=t/2;
extrac=t%2;
ans=pow(2,years+1)-1;
if (extrac)
ans*=2;
printf("%d\n", ans);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment