原创 HDU - 2809 God of War (暴力狀壓dp)(模擬)

At 184~280 A.D ,there were many kingdoms in China. Three strongest among them are “Wei”, “Shu”, “Wu”. People call t

原创 Hello Kiki HDU - 3579(擴展中國剩餘定理)

One day I was shopping in the supermarket. There was a cashier counting coins seriously when a little kid running

原创 Fish eating fruit 點分治

傳送門:https://nanti.jisuanke.com/t/41403 求樹中兩點距離%3爲0,1,2的距離和 #include<iostream> #include<algorithm> #include<string.h

原创 Tree POJ - 1741(樹分治模板)

Give a tree with n vertices,each edge has a length(positive integer less than 1001). Define dist(u,v)=The min dista

原创 X問題 HDU - 1573(中國剩餘定理水題)

求在小於等於N的正整數中有多少個X滿足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2], …, X mod a[i] = b[i], … (0 < a[i] <=

原创 Codeforces343D(SummerTrainingDay06-F dfs序+線段樹)

#include<iostream> #include<vector> using namespace std; vector<int> G[500009]; int in[500009],out[500009],father[

原创 轉主席樹代碼

1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 const int N=2e5+10; 5 const int M=N*10; 6 s

原创 Destiny CodeForces - 840D(主席樹)

Once, Leha found in the left pocket an array consisting of n integers, and in the right pocket q queries of the for

原创 poj2891 中國剩餘定理標準模板

Elina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The

原创 Codeforces 161D Distance in Tree(樹的點分治)

A tree is a connected graph that doesn’t contain any cycles. The distance between two vertices of a tree is the len

原创 Minimum Inversion Number HDU - 1394(樹狀數組/權值線段樹求逆序對)

The inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i < j an

原创 米勒羅賓素數檢測模板

#include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #define LL unsigned long long//注意這個lo

原创 bzoj1101 (莫比烏斯反演+整除分塊+輸入掛標準模板)

FGD正在破解一段密碼,他需要回答很多類似的問題:對於給定的整數a,b和d,有多少正整數對x,y,滿足x<=a ,y<=b,並且gcd(x,y)=d。作爲FGD的同學,FGD希望得到你的幫助。 Input 第一行包含一個正整數n,

原创 ellery此博客暫時停用

這是新博客地址:https://www.cnblogs.com/ellery/ csdn廣告太煩,但是手機端蠻好用的

原创 bzoj 2152: 聰聰可可(樹分治)

2152: 聰聰可可 Time Limit: 3 Sec Memory Limit: 259 MB Submit: 5933 Solved: 3156 [Submit][Status][Discuss] Description