原创 2019牛客暑期多校訓練營(第五場) B-generator 1 (十進制矩陣快速冪)

鏈接:https://ac.nowcoder.com/acm/contest/885/B 來源:牛客網   題目描述 You are given four positive integers x0,x1,a,bx_0, x_1, a,

原创 P1226 【模板】快速冪||取餘運算 洛谷(十進制思路)

題目描述 輸入b,p,k的值,求b^p mod k的值。其中b,p,k*k爲長整型數。 輸入格式 三個整數b,p,k. 輸出格式 輸出“b^p mod k=s” s爲運算結果 輸入輸出樣例 輸入 #1 2 10 9 輸出 #1 2

原创 Part Acquisition POJ - 2457 (Spfa+優先隊列優化+輸出路徑)

The cows have been sent on a mission through space to acquire a new milking machine for their barn. They are flying th

原创 Codeforces D. Vasiliy's Multiset (01字典樹)

D. Vasiliy's Multiset time limit per test 4 seconds memory limit per test 256 megabytes input standard input output st

原创 Codeforces E. Sausage Maximization (01字典樹)

E. Sausage Maximization time limit per test 2 seconds memory limit per test 256 megabytes input standard input output

原创 A - Palisection (Manacher)

In an English class Nick had nothing to do at all, and remembered about wonderful strings called palindromes. We shoul

原创 Palindromes and Super Abilities (迴文自動機)

After solving seven problems on Timus Online Judge with a word “palindrome” in the problem name, Misha has got an unus

原创 牛客練習賽51 子串查詢 (序列自動機)

鏈接:https://ac.nowcoder.com/acm/contest/1083/B 來源:牛客網   題目描述 給出一個長度爲n的字符串s和q個查詢。對於每一個查詢,會輸入一個字符串t,你需要判斷這個字符串t是不是s的子串。子串

原创 CA Loves Palindromic (迴文自動機)

CA loves strings, especially loves the palindrome strings. One day he gets a string, he wants to know how many palindr

原创 2019牛客暑期多校訓練營(第十場) Coffee Chicken(DFS)

鏈接:https://ac.nowcoder.com/acm/contest/890/B 來源:牛客網   Dr. JYY has just created the Coffee Chicken strings, denoted as

原创 J - Life Forms POJ - 3294 (後綴數組 + 二分)

You may have wondered why most extraterrestrial life forms resemble humans, differing by superficial traits such as he

原创 P1019 單詞接龍

題目描述 單詞接龍是一個與我們經常玩的成語接龍相類似的遊戲,現在我們已知一組單詞,且給定一個開頭的字母,要求出以這個字母開頭的最長的“龍”(每個單詞都最多在“龍”中出現兩次),在兩個單詞相連時,其重合部分合爲一部分,例如 beastbe

原创 L - Substrings POJ - 1226 (後綴數組+二分)

You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either

原创 K - Relevant Phrases of Annihilation (後綴數組 + 二分)

You are the King of Byteland. Your agents have just intercepted a batch of encrypted enemy messages concerning the dat

原创 I - Common Substrings POJ - 3415 (後綴數組+單調棧)

A substring of a string T is defined as:   T( i, k)= TiTi +1... Ti+k -1, 1≤ i≤ i+k-1≤| T|.   Given two strings A, B an