Guest User

Untitled

a guest
Nov 16th, 2019
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define sp << " " <<
  6. #define mod 998244353
  7. #define mp make_pair
  8. #define pb push_back
  9. #define int long long
  10. #define double long double
  11. #define INF 1e18
  12. #define PI 3.14159265359
  13.  
  14. int power(int p,int y)
  15. {
  16.     int res=1;
  17.     p=p%mod;
  18.     while(y>0)
  19.     {
  20.         if(y&1)
  21.             res=(res*p)%mod;
  22.         y=y>>1;
  23.         p=(p*p)%mod;
  24.     }
  25.     return res;
  26. }
  27.  
  28. /*
  29. mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  30.  
  31. int dice()
  32. {
  33.     uniform_int_distribution<int> uid(0,1);//specify l and r.
  34.     return uid(rng) ;
  35. }
  36.  
  37. int read()
  38. {
  39.        int cc = getc(stdin);
  40.        for (;cc < '0' || cc > '9';)  cc = getc(stdin);
  41.        int dp = 0;
  42.        for (;cc >= '0' && cc <= '9';)
  43.        {
  44.           dp = dp * 10 + cc - '0';
  45.           cc = getc(stdin);
  46.        }
  47.       return dp;
  48. }
  49.  
  50. inline void print(int n)
  51. {
  52.   if (n == 0)
  53.   {
  54.     putchar('0');
  55.     putchar('\n');
  56.   }
  57.   else if (n == -1)
  58.   {
  59.     putchar('-');
  60.     putchar('1');
  61.     putchar('\n');
  62.   }
  63.   else
  64.   {
  65.     char buf[20];
  66.     buf[19] = '\n';
  67.     int i = 18;
  68.     while (n)
  69.     {
  70.       buf[i--] = n % 10 + '0';
  71.       n /= 10;
  72.     }
  73.     while (buf[i] != '\n')
  74.       putchar(buf[++i]);
  75.   }
  76. }
  77. */
  78. int32_t main()
  79. {
  80.     ios::sync_with_stdio(false);
  81.     cin.tie(0);
  82.     cout.tie(0);
  83.     //freopen("input.txt", "r", stdin);
  84.     //freopen("output.txt", "w", stdout);
  85.     int n;
  86.     cin>>n;
  87.     cout<<(power(2,n-2)+1)%mod<<'\n';
  88.     return 0;
  89. }
Add Comment
Please, Sign In to add comment