這道題在打網路賽的時候
我說了乙個假的dp
導致學長最後乙個小時全在證我的假dp
好丟人不對
沒什麼丟人的
好驕傲嗯
然後這道題是fft的乙個**
然而我以前沒有學過fft
現在終於自己學會了
標程:
#include #include #include #include #include using namespace std;
const double pi = acos(-1.0);
//複數結構體
struct complex
complex operator -(const complex &b)const
complex operator +(const complex &b)const
complex operator *(const complex &b)const
};/*
* 進行fft和ifft前的反轉變換。
* 位置i和 (i二進位制反轉後位置)互換
* len必須去2的冪
*/void change(complex y,int len)
if(j < k)j += k;
}}/*
* 做fft
* len必須為2^k形式,
* on==1時是dft, on==-1時是idft
*/void fft(complex y,int len,int on)}}
if(on == -1)
for(int i = 0; i < len; i++)
y[i].x /= len;
}const int maxn = 1000005;
complex x1[maxn],x2[maxn];
char str1[maxn/2],str2[maxn/2];
int sum[maxn];
int main()
return 0;
}
寧夏網路賽 F Moving On
一道簡單的floyd題,但是是動態加點求多次有限制的最短路,感覺這個思想很好,當然可以直接dp 題目給你乙個圖,然後對於每乙個節點都有乙個點權,然後有q次詢問,每次詢問兩點間的最短距離,並且最短路徑中不能通過任意乙個點權大於等於w的點,首尾不算 一次詢問的話,直接最短路亂搞就行了,但是詢問次數很多的...
校選拔賽H題
給出毛毯一部分,可以在平面內無限延伸 問對給乙個 是否能與毛毯匹配 include using namespace std char mp1 53 53 mp 103 803 毛毯,int n,m,k 毛毯行,列,數 int check int x,int y,int w,int h 上面的匹配是自...
2023年省賽H題
2013年省賽h題 你不能每次都快速冪算a x,優化就是預處理,把10 9預處理成10 5和10 4。想法真的是非常巧妙啊 n 100000 構造兩個陣列,f1 n 間隔為a f2 1e4 間隔為a n,中間用f1來填補 f x f1 x n f2 x n p 1 include2 include3...