fork(2) download
  1. #include <vector>
  2. #include <list>
  3. #include <map>
  4. #include <set>
  5. #include <queue>
  6. #include <deque>
  7. #include <stack>
  8. #include <bitset>
  9. #include <algorithm>
  10. #include <cassert>
  11. #include <functional>
  12. #include <numeric>
  13. #include <utility>
  14. #include <sstream>
  15. #include <iostream>
  16. #include <iomanip>
  17. #include <cstdio>
  18. #include <cmath>
  19. #include <cstdlib>
  20. #include <ctime>
  21. #include <cstring>
  22. #include<stdio.h>
  23.  
  24. using namespace std;
  25.  
  26. long int power(long int n, long int p)
  27. {
  28. if(p==0) return 1;
  29.  
  30. else if(p%2==0)
  31. return (power(3,p/2)*power(3,p/2));
  32.  
  33. else
  34. return (power(3,p-1)*3);
  35. }
  36.  
  37. int main()
  38. {
  39.  
  40. unsigned long int t,n;
  41. cin>>t;
  42. while(t>0)
  43. {
  44. t--;
  45. cin>>n;
  46. cout<<power(3,n)<<"\n";
  47.  
  48. }
  49. return 0;
  50. }
Runtime error #stdin #stdout 0s 10960KB
stdin
Standard input is empty
stdout
Standard output is empty