原创 bzoj3652 大新聞(數位DP)

傳送門:http://www.lydsy.com/JudgeOnline/problem.php?id=3652 第一問只用統計出所有位1的個數即可。第二問我們用記憶化搜索。dp[len][cur][l]表示當前長度爲len。若c

原创 bzoj1977 [BeiJing2010組隊]次小生成樹 Tree

在普通次小生成樹的基礎上再維護一個樹上嚴格次大值即可。 #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<cmath>

原创 Codeforces Round #414 (Div1+Div2) G Replace All (組合數學)

考慮給定兩個M、N串的情況: 定義:兩個01串S,T(|S|≤|T|) 是coprime 的當且僅當S=T 。或者如果S 是T 的一個前綴,並令T=S+X ,如果S,X 是coprime 的,那麼S,T 也是coprime 的。

原创 C++ 04 —— 構造函數

源碼 // 04Constructor.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "io

原创 C++ 03 —— this

源碼 // 03This.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostream.

原创 hdu1506 Largest Rectangle in a Histogram (笛卡爾樹)

傳送門:http://acm.hdu.edu.cn/showproblem.php?pid=1506 標解應該是DP。不過這裏可以當做笛卡爾樹模板題來做。笛卡爾樹的構造方式爲:首先我們按照橫座標從左往右進行處理,同時維護一個單調棧

原创 C++ 06 —— 拷貝構造函數

源碼 // 06CopyConstructor.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include

原创 bzoj2820 YY的 (莫比烏斯函數)

枚舉質數p ,可以得到 ∑p=1min(n,m)∑t=1min(n/p,m/p)μ(t)[n/pt][m/pt] 令T=pt ,原式可以化爲 ∑T=1min(n,m)[nT][mT]∑p|Tμ(Tp) 後面一部分我們暴力枚舉

原创 bzoj4521 [Cqoi2016]手機號碼 (數位DP)

dp[len][last][num][f4][f8][cur][pp] 。len 表示當前長度,last 表示上一個數字,num 表示當前連續相同數字的長度,f4 表示是否出現過4 ,f8 表示是否出現過8 ,cur 表示是否沿着

原创 bzoj2301 [HAOI2011]Problem b (莫比烏斯函數)

首先可以想到分爲四個前綴區間進行加加減減,考慮[1,a],[1,b] 這組: ∑i=1a∑j=1b[gcd(i,j)==k] =∑i=1a/k∑j=1b/k[gcd(i,j)==1] =∑i=1a/k∑j=1b/k∑t|i,

原创 hackinglab 腳本關 writeup

key又又找不到了 先點開通關地址 之後點擊這個鏈接,攔截它的response,可以得到key 快速口算 寫個腳本就行了。利用正則來提取相關信息。 import requests import re url = 'htt

原创 bzoj3039 玉蟾宮 (懸線法)

參考《淺談用極大化思想解決最大子矩形問題》–王知昆 #include<cstdio> #include<cstring> #include<cstdlib> #include<iostream> #include<cmath> #

原创 C++ 07 —— static

源碼 // 07Static.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostrea

原创 實驗吧 RE 題解

babyCrack 利用PEID發現是.NET程序,沒有加殼,直接用IDA查看 得到key hctf{bABy_CtsvlmE_!} 阿拉丁神燈 利用PEID發現是.NET程序,沒有加殼,直接用IDA查看 將這串字

原创 C++ 02 —— 訪問權限

源碼 // 02AccessControl.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "