原创 msc的揹包(擋板法)

鏈接:https://ac.nowcoder.com/acm/contest/217/D 來源:牛客網   題目描述 msc是個可愛的小女生,她喜歡許許多多稀奇古怪的小玩意。 一天,msc得到了一個大小爲k的揹包,她決定去買東西。 商店裏

原创 Rabbit Kingdom HDU - 4777 (離線處理+樹狀數組)

Rabbit Kingdom  HDU - 4777  題意:給定n個數a[i] ( 1=< i <=n) 現在給定m個詢問,每個詢問一個區間[l,r],問該區間有多少個數與其它所有的數互素。 1 =< n,m,a[i] <= 20000

原创 HDU - 3336 (Next數組+dp)

Count the string   HDU - 3336     題意:給定字符串s,求s的所有前綴作爲子串在s中出現的次數和。 思路:考慮dp dp[i] 表示以第i個字母結尾的所有後綴與s的前綴的匹配次數。 按照最暴力的想法來做的話

原创 最大m子段和

  最大M子段和  51Nod - 1052  題意描述:給定數組a,長度爲n。給定整數m,求不相交的m段字段和的最大值。   當m == 1 時:該問題就是最大子段和問題。 設dp[i]爲以a[i]結尾的最大子段和,當我們考慮dp[i]

原创 Neko's loop(RMA+循環羣)

Problem Description Neko has a loop of size n. The loop has a happy value ai on the i−th(0≤i≤n−1) grid.  Neko likes to

原创 Buy and Resell(貪心)

Buy and Resell Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s):

原创 牛客多校第九場 Niuniu is practicing typing.(kmp優化)

鏈接:https://www.nowcoder.com/acm/contest/147/F 來源:牛客網   Niuniu is practicing typing. Given n words, Niuniu want to input

原创 數字串(線段樹)

鏈接:https://www.nowcoder.com/acm/contest/112/D來源:牛客網時間限制:C/C++ 1秒,其他語言2秒空間限制:C/C++ 262144K,其他語言524288K 6

原创 The equation SGU - 106 (exgcd)

There is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must determine, how many integer roots of this equati

原创 F. The Neutral Zone(優化素數篩)

F. The Neutral Zone time limit per test 5 seconds memory limit per test 16 megabytes input standard input output standa

原创 sequence (2018山東省第九屆ACM省賽- - CSDN博客)

謹以此篇博客記錄第一次acm競賽,E題給我的印象還是比較深刻的,和隊友分析了好久才寫出來,不過幸好一遍過了。題意:給一個由1-n組成的排列,定義ai是好數,只要存在aj(1=<j<i)使得的aj < ai;讓你必須找一個數使得去了它剩餘的

原创 牛客網多校第五場 inv (思維+逆序)

鏈接:https://www.nowcoder.com/acm/contest/143/D 來源:牛客網   Kanade has an even number n and a permutation b of all of the ev

原创 Chiaki Sequence Revisited(二分)

  Problem Description Chiaki is interested in an infinite sequence a1,a2,a3,... , which is defined as follows: An = A(

原创 Simple Polynomial Problem FZU - 2215 (字符串求值+多項式)

You are given an polynomial of x consisting of only addition marks, multiplication marks, brackets, single digit number

原创 D. Mahmoud and Ehab and another array construction task(因子標記)

D. Mahmoud and Ehab and another array construction tasktime limit per test3 secondsmemory limit per test256 megabytesin