All pastes #935215 Raw Edit

Someone

public text v1 · immutable
·published 2008-03-09 13:07 UTC
rendered paste body
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

long long prob5(int n);
long long pow (int x , int y)
{
     long long ans = 1 ;
     while (y--)
     {
           ans *= x ;      
     }
     return ans;
}
int main()
{
   int t;
   cin >> t ;
   vector <int> ns;
   for (int i = 0 ; i < t ; i ++)
   {
   	int n;
   	cin>>n;
   	ns.push_back(n);
   }
   for (int i = 0 ; i < t ; i++)
   {
   	long long ans = prob5(ns[i]);
   	cout<<ans<<endl;
   }
   return 0;
}


long long prob5(int n)
{
    
    long long vount=(pow(3,n)+1)/2;
    return vount;
    
}