这是我在 CSDN 发的第一篇博客,请多指教!
以前都是看别人写博,今天终于开通了我的第一篇博客!也发现了可以自定义主题以及 Markdown 之类有意思的功能。
那么,以后的编程道路上,我的一些学习笔记、算法心得、解题报告、总结反思、比赛游记之类,就都不会发到这里啦。
希望之后能在这个平台学到更多的知识,交到更多的朋友。那么就在这里立个 flag 吧,从今天开始,要坚持每个月至少写 0 0 0 篇博客!
既然这篇文章的标题叫 Hello World \texttt{Hello World} Hello World,最后就放一个板子吧!
P . S . \mathcal{P.S.} P.S. 下面的 Hello World \texttt{Hello World} Hello World 代码是我复制来的,本人是 c++ \texttt{c++} c++ 小白,里面的语法我现在也看不懂……但我相信以后总会看懂的!
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define int long long
#define maxn 5000005
#define O1 3
#define O2 332748118
#define p 998244353
#define inv2 499122177
using namespace std;
inline int read(){
int x = 0, flag = 1;
char ch = getchar();
while(ch < '0' || ch > '9'){
if(ch == '-') flag = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9'){
x = (x << 3) + (x << 1) + ch - '0';
ch = getchar();
}
return x * flag;
}
inline int readk(){
int x = 0, flag = 1;
char ch = getchar();
while(ch < '0' || ch > '9'){
if(ch == '-') flag = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9'){
x = ((x << 3) + (x << 1) + ch - '0') % p;
ch = getchar();
}
return x * flag;
}
int qpow(int a, int b){
int ans = 1;
while(b){
if(b & 1) ans = ans * a % p;
a = a * a % p;
b >>= 1;
}
return ans;
}
int limit, ceng, rev[maxn];
void ntt(int *f, bool o){
for(int i = 0; i < limit; ++i) if(i < rev[i]) swap(f[i], f[rev[i]]);
for(int mid = 1; mid < limit; mid <<= 1){
int n = mid << 1;
int w1 = qpow(o? O1 : O2, (p - 1) / n);
for(int j = 0; j < limit; j += n){
int wa = 1;
for(int k = 0; k < mid; ++k){
int x = f[j + k], y = f[j + k + mid] * wa % p;
f[j + k] = (x + y) % p;
f[j + k + mid] = (x - y + p) % p;
wa = wa * w1 % p;
}
}
}
if(!o){
int inv = qpow(limit, p - 2);
for(int i = 0; i < limit; ++i) f[i] = f[i] * inv % p;
}
return;
}
void getdao(int *f, int *g, int n){
for(int i = 1; i < n; ++i) g[i-1] = f[i] * i % p;
return;
}
void getji(int *f, int *g, int n){
for(int i = n - 1; i; --i) g[i] = f[i-1] * qpow(i, p-2) % p;
f[0] = 0;
return;
}
void mul(int *a, int *b, int n, int m){
limit = 1, ceng = 0;
while(n + m >= limit) limit <<= 1, ++ceng;
for(int i = m; i <= limit; ++i) b[i] = 0;
for(int i = 0; i < limit; ++i) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (ceng - 1));
ntt(a, 1);
ntt(b, 1);
for(int i = 0; i <= limit; ++i) a[i] = a[i] * b[i] % p;
ntt(a, 0);
for(int i = n + m - 1; i <= limit; ++i) a[i] = 0;
return;
}
int Ainv[maxn];
void getinv(int *a, int *b, int n){
if(n == 1){
b[0] = qpow(a[0], p - 2);
return;
}
getinv(a, b, (n + 1) >> 1);
limit = 1, ceng = 0;
while(limit <= (n << 1)) limit <<= 1, ++ceng;
for(int i = 1; i < limit; ++i) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (ceng - 1));
for(int i = 0; i < n; ++i) Ainv[i] = a[i];
for(int i = n; i < limit; ++i) Ainv[i] = 0;
ntt(Ainv, 1);
ntt(b, 1);
for(int i = 0; i < limit; ++i) b[i] = ((2LL - b[i] * Ainv[i]) % p * b[i] % p + p) % p;
ntt(b, 0);
for(int i = n; i <= limit; ++i) b[i] = 0;
return;
}
int fr[maxn], gr[maxn], invg[maxn], s[maxn], y[maxn];
void div(int *f, int *g, int n, int m){
for(int i = 0; i < n; ++i) fr[n - i - 1] = f[i];
for(int i = 0; i < m; ++i) gr[m - i - 1] = g[i];
for(int i = n - m + 1; i < m; ++i) gr[i] = 0;
getinv(gr, invg, n - m + 1);
mul(fr, invg, n + 1, n - m + 1);
reverse(fr, fr + n - m + 1);
for(int i = 0; i <= n - m; ++i) s[i] = fr[i];
mul(g, fr, m + 1, n - m + 1);
for(int i = 0; i < m - 1; ++i) y[i] = (f[i] - g[i] + p) % p;
return;
}
int invb[maxn], Aqsrt[maxn];
void getsqrt(int *a, int *b, int n){
if(n == 1){
b[0] = 1;
return;
}
getsqrt(a, b, (n + 1) >> 1);
limit = 1, ceng = 0;
while(limit < (n << 1)) limit <<= 1, ++ceng;
for(int i = 1; i < limit; ++i) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (ceng - 1));
for(int i = 0; i < n; ++i) Aqsrt[i] = a[i];
for(int i = n; i < limit; ++i) Aqsrt[i] = 0;
for(int i = 0; i <= limit; ++i) invb[i] = 0;
getinv(b, invb, n);
ntt(Aqsrt, 1);
ntt(b, 1);
ntt(invb, 1);
for(int i = 0; i < limit; ++i) b[i] = ((Aqsrt[i] * invb[i] % p + b[i]) % p * inv2 % p);
ntt(b, 0);
for(int i = n; i < limit; ++i) b[i] = 0;
return;
}
int ln1[maxn], ln2[maxn];
void getln(int *f, int *g, int n){
memset(ln2, 0, sizeof(ln2));
limit = 1, ceng = 0;
while(limit <= (n << 1)) limit <<= 1, ++ceng;
getdao(f, ln1, n);
getinv(f, ln2, n);
for(int i = n; i <= limit; ++i) ln1[i] = ln2[i] = 0;
for(int i = 1; i < limit; ++i) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (ceng - 1));
ntt(ln1, 1);
ntt(ln2, 1);
for(int i = 0; i < limit; ++i) g[i] = ln1[i] * ln2[i] % p;
ntt(g, 0);
getji(g, g, limit);
return;
}
int lnb[maxn], cexp[maxn];
void getexp(int *f, int *g, int n){
if(n == 1){
g[0] = 1;
return;
}
getexp(f, g, (n + 1) >> 1);
getln(g, lnb, n);
limit = 1, ceng = 0;
while(limit <= (n << 1)) limit <<= 1, ++ceng;
for(int i = 0; i < n; ++i) cexp[i] = ((f[i] - lnb[i]) % p + p) % p;
for(int i = n; i < limit; ++i) cexp[i] = 0;
++cexp[0];
ntt(g, 1);
ntt(cexp, 1);
for(int i = 0; i < limit; ++i) g[i] = g[i] * cexp[i] % p;
ntt(g, 0);
for(int i = n; i < limit; ++i) g[i] = 0;
return;
}
int gmi[maxn];
void getmi(int *f, int *g, int n, int k){
getln(f, gmi, n);
for(int i = 0; i < n; ++i) gmi[i] = gmi[i] * k % p;
getexp(gmi, g, n);
return;
}
signed main(){
puts("Hello World!");
return 0;
}
希望与大家共勉!