原创 DFS一直寫不好啊啊啊

n個數字裏必須有連續m個數的和爲質數 例如(12,1)就必須由12個質數組成 n<=12,m<=4 #include <cstdio> #include <cmath> #include <iostream> #include

原创 bitset優化揹包...

題目: https://s3.amazonaws.com/codechef_shared/download/translated/SNCKEL16/mandarin/RWALK.pdf 這題可以轉化成揹包。 L,R什麼的可以

原创 日常補題

CFR 363 給定一個序列: ai equals 0, if on the i-th day of vacations the gym is closed and the contest is not carried out

原创 枚舉+前綴和...

給一個3*1e5的數字串,判斷該串中有多少個子串%64==0,0也算,有前導0的不算 例如 64064 [64]064 64[0]64 640[64] [640]64 [64064] 括號內即爲符合條件的子串,064

原创 ...

POJ 3468 線段樹的成段更新加延遲標記 #include<string.h> #include<iostream> #include<algorithm> #include<stdio.h> using namespac

原创 BC,HDU 5719

#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long lon

原创 八皇后

第cur行放置第i列的皇后 c[cur]=i; #include <bits/stdc++.h> using namespace std; typedef long long LL; int c[100],ans=0,n; vo

原创 文章標題

http://www.cnblogs.com/YY56/p/5452674.html 從這學來的一個新姿勢=_= 對原數組val離散化然後對離散化後的數組Hash排序,還要去重。 然後按順序對原數組val按順序進行一次Que

原创 HDU1166

第一道線段樹…. #include <stdio.h> #include <string.h> #include <algorithm> #include <math.h> #include <stdlib.h> using na

原创 組合數的不同質因子

求組合數C(n,m)有多少個不同的質因子。 C(n,m)=n!/( m!*(n-m)! ) P(N!)=N/i+N/i^2+N/i^3+…..N/i^m是一個可以求N!中有多少個質因子i,例如7!中有4個質因子2,那麼P(n!

原创 POJ3254 狀壓dp入門

參考了大神的思路… http://blog.csdn.net/accry/article/details/6607703 #include<cstdio> #include<cmath> #include<algorithm>

原创 HDU 5651

居然忘記了高中的組合數公式 在計算組合數取模的過程中很難處理除法。。。 所以要用到C(N,M)=C(N-1,M-1)+C(N-1,M) 從C(1,1)一直遞推,就可以避免除法了… 要注意初始化C(i,0)=1;沒初始化這個

原创 CF

510 2C #include<bits/stdc++.h> using namespace std; const int maxn=2e5+5; const int inf=1e9+5; int n,a[maxn],cnt; vec

原创 cf 517 div2A

#include using namespace std; const int N=1e5+5; int a[N]; int b[N]; int c[N]; int n; int f; int main() {cin>>n; for

原创 CF

517 B #include #include #include #include using namespace std; int f[5][5][5]; int n,a[100006],b[100006],ans[1000