原创 張老師的旅行(區間dp)

張老師的旅行 鏈接:https://ac.nowcoder.com/acm/contest/5477/C 來源:牛客網 時間限制:C/C++ 1秒,其他語言2秒 空間限制:C/C++ 262144K,其他語言524288K 64b

原创 Scout YYF I (POJ - 3744)(概率dp+矩陣快速冪)

Scout YYF I POJ - 3744 YYF is a couragous scout. Now he is on a dangerous mission which is to penetrate into the en

原创 codeforces 55D Beautiful numbers(數位DP)

Beautiful numbers Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer n

原创 牛客Talk(概率dp)

題目描述 衆所周知,牛可樂 的口胡能力十分強大.牛可樂 要講 n 件事情,我們把這些事情從 1∼n 標號。牛可樂每講一件事需要耗費一個單位的時間,但是 牛可樂講事情和普通人不同:牛可樂在 講完 第 i 件事時,只有 pi 的概率繼

原创 Eugene and an array(思維)

Eugene and an array time limit per test:1.5 seconds memory limit per test:256 megabytes input:standard input outpu:

原创 Nature Reserve(最小生成森林)

Nature Reserve Kattis - naturereserve In a Nature Reserve and Wildlife Park, there are NNN environmental monitoring

原创 後綴自動機

#include<bits/stdc++.h> using namespace std; const int maxn = 2e6+9;//一般有2n個等價類 int tot=1,las=1; char s[maxn]; long lo

原创 Tree with Maximum Cost(樹形DP)

  You are given a tree consisting exactly of nn vertices. Tree is a connected undirected graph with n−1n−1 edges. Each

原创 Research Productivity Index

Research Productivity Index  Kattis - researchproductivityindex  Angela is a new PhD student and she is nervous about t

原创 點分治(模板)

Tree  POJ - 1741    Give a tree with n vertices,each edge has a length(positive integer less than 1001).  Define dist(u

原创 Charles in Charge Gym - 101490E (隊列優化dij+二分)

https://vjudge.net/contest/350975#problem/E   題意:給一張無向圖,求一條從1到n路上的最大邊,使得其最小,同時還要滿足 這條路長度<=最短路*(1+X%)   先跑一邊最短路,求出最短路 然後

原创 Equidistant Gym - 102411E

In 2019 ICPC subregions structure was changed a little. Now for each subregion, we need to choose the best place for th

原创 Flying Squirrel Gym - 102091A (RMQ)

https://vjudge.net/contest/351286#problem/A 題意:1~n位置有不同高度的柱子,一直飛鼠只能從一個柱子飛到高度嚴格比它小的柱子; 給定n個柱子的高度 ,m次詢問:1.從一個柱子最多能飛到多少個柱子

原创 Master of Phi HDU - 6265(數論)

Problem B. Master of Phi You are given an integer n. Please output the answer of ∑ d|n φ(d) × n d modulo 998244353. n i

原创 P2522 [HAOI2011]Problem b(Mobius經典題目)

題目描述 對於給出的n個詢問,每次求有多少個數對(x,y),滿足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函數爲x和y的最大公約數。 輸入格式 第一行一個整數n,接下來n行每行五個整數,分別表示a、b、c、d、k