Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define sp << " " <<
- #define mod 998244353
- #define mp make_pair
- #define pb push_back
- #define int long long
- #define double long double
- #define INF 1e18
- #define PI 3.14159265359
- int power(int p,int y)
- {
- int res=1;
- p=p%mod;
- while(y>0)
- {
- if(y&1)
- res=(res*p)%mod;
- y=y>>1;
- p=(p*p)%mod;
- }
- return res;
- }
- /*
- mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
- int dice()
- {
- uniform_int_distribution<int> uid(0,1);//specify l and r.
- return uid(rng) ;
- }
- int read()
- {
- int cc = getc(stdin);
- for (;cc < '0' || cc > '9';) cc = getc(stdin);
- int dp = 0;
- for (;cc >= '0' && cc <= '9';)
- {
- dp = dp * 10 + cc - '0';
- cc = getc(stdin);
- }
- return dp;
- }
- inline void print(int n)
- {
- if (n == 0)
- {
- putchar('0');
- putchar('\n');
- }
- else if (n == -1)
- {
- putchar('-');
- putchar('1');
- putchar('\n');
- }
- else
- {
- char buf[20];
- buf[19] = '\n';
- int i = 18;
- while (n)
- {
- buf[i--] = n % 10 + '0';
- n /= 10;
- }
- while (buf[i] != '\n')
- putchar(buf[++i]);
- }
- }
- */
- int32_t main()
- {
- ios::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- int n;
- cin>>n;
- cout<<(power(2,n-2)+1)%mod<<'\n';
- return 0;
- }
Add Comment
Please, Sign In to add comment