#include <stdio.h> #include <math.h> int main () { int t,num,s,bad,good,i,a,sum; scanf ("%d",&t); num = 1; while (t--){ scanf ("%d",&s); printf ("Scenario #%d:\n",num); if (s == 1) { printf ("%d\n",2); num++; continue; } sum = pow (2,s); //bad = 0; a = s-2; bad = a*pow(2,a-1)+pow(2,a); good = sum - bad; printf ("%d\n",good); num++; } return 0; } |
Double click to view unformatted code.