当前位置:网站首页>Lambda expression learning

Lambda expression learning

2022-07-06 04:10:00 whitewall_ nine

#include<iostream>
#include<map>
using namespace std;

#define rep(i,l,r) for(int i=(l);i<=(r);i++)
#define per(i,l,r) for(int i=(l);i>=(r);i--)
#define ll long long
#define pii pair<int, int>
#define mset(s,t) memset(s,t,sizeof(t))
#define mcpy(s,t) memcpy(s,t,sizeof(t))
#define fir first
#define pb push_back
#define sec second
#define sortall(x) sort((x).begin(),(x).end())
inline int read () {
	int x = 0, f = 0;
	char ch = getchar();
	while (!isdigit(ch)) f |= (ch=='-'),ch= getchar();
	while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
	return f?-x:x;
}
template<typename T> void print(T x) {
	if (x < 0) putchar('-'), x = -x;
	if (x >= 10) print(x/10);
	putchar(x % 10 + '0');
}
const int mod = 998244353;
ll x;
map<ll, ll> cnt;
void solve() {
	cin >> x;
	auto f = [&](auto f, ll x) -> ll {
		if (cnt[x]) return cnt[x];
		if (x <= 4) return x;
		return cnt[x] = f(f, x / 2) * f(f, (x+ 1) / 2) %mod;
	};
	
	cout << f(f, x) << endl;
}
int main () {
    int t;
    t = 1;
    while (t --) solve();
    return 0;
}

[&] To use this , Use this representation to capture all external variables so that you can assign values to other variables

原网站

版权声明
本文为[whitewall_ nine]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202132243332120.html