原创 基於golang的手機號碼簡易爬蟲

 百度一下手機號碼,隨便進一個網址。利用正則表達式獲取這個網址的所有手機號碼 package main import ( "fmt" "io/ioutil" "net/http" "os" "regexp" ) var (

原创 牛客網 leetcode subsets

題目鏈接  題目描述 現在有一個沒有重複元素的整數集合S,求S的所有子集 注意: 你給出的子集中的元素必須按非遞增的順序排列 給出的解集中不能出現重複的元素 例如: 如果S=[1,2,3], 給出的解集應爲: [↵ [3],↵ [1

原创 Codeforces Round #603 (Div. 2) D Secret Passwords (並查集)

題目鏈接  #include <bits/stdc++.h> const int maxn = 100 ; int fa[maxn],ans,n; char s[maxn]; bool vis[maxn]; inline int

原创 golang實現kruskal最小生成樹

package main import ( "bufio" "fmt" "os" "sort" "strconv" "sync" ) type Edge struct { u int v int w int

原创 python 徹底刪除一個文件夾(包括子文件及文件夾)

記錄一個python腳本  import os import sys import shutil def del_file(filepath): del_list = os.listdir(filepath) for

原创 2019 icpc 銀川區域賽 G Pot!! (線段樹)

  #include <bits/stdc++.h> const int maxn = 1e5 + 5; int n,q; struct SegTree { int maxx[maxn<<2],lazy[maxn<<2]; i

原创 python 找到當前目錄下所有文件夾

得到File目錄下所有文件  def findallfile(path): for root, ds, fs in os.walk(path): for f in ds: fullname = os.path.join(ro

原创 2017ACM/ICPC廣西邀請賽-重現賽 hdu 6187

  Long times ago, there are beautiful historic walls in the city. These walls divide the city into many parts of area. 

原创 poj 1655 Balancing Act (樹的重心)

  Consider a tree T with N (1 <= N <= 20,000) nodes numbered 1...N. Deleting any node from the tree yields a forest: a

原创 2019 acm icpc西安邀請賽 M Travel

Travel   22.85%  1000ms  262144K There are nn planets in the MOT galaxy, and each planet has a unique number from 1 \si

原创 2019 acm icpc西安邀請賽 C Angel's Journey

Angel's Journey   24.64%  1000ms  262144K “Miyane!” This day Hana asks Miyako for help again. Hana plays the part of an

原创 OpenGL 學習筆記 光柵化 (Rasterization)

光柵化是將一個圖元轉變維一個二維圖像的過程。二維圖像上每個點都包含了顏色、深度和紋理數據。將該點和相關信息叫做一個片元。 光柵化的目的是找出一個幾何單元所覆蓋的像素。通俗來說:模型的那些頂點在經過矩陣變換後也僅僅是頂點。而由頂點構成的三角

原创 使用golang對一個切片去重並排序

最近在寫一個小項目的時候需要將數據去重,搜了搜文檔發現好像沒有去重的實現。就是類似C++的unique 所以只能手動實現一下了,在此記錄一下。 思路很簡單就是利用內置的map逐個判斷就好了,最後我還排了個序,返回一個去重並且排過序的切片

原创 2015年藍橋杯C/C++省賽大學A組 災後重建 (樹上倍增最值+線段樹)

題目鏈接 100分的做法: 當p>sqrt(n)時, 這時候%p=c的點不超過sqrt(n)個, 直接倍增求路徑最值就好了 當p<=sqrt(n)時,將詢問離線, 按照p和c從小到大排序,同時處理出所有p相同且c相同的區間詢問 對於同一個

原创 Codeforces Round #603 (Div. 2) E. Editor (線段樹維護全局最值)

題目鏈接  #include <bits/stdc++.h> const int maxn = 1e6 + 5; int sum[maxn<<2],mi[maxn<<2],ma[maxn<<2],n; char s[maxn];