原创 Codeforces Beta Round #1 A. Theatre Square

題意:n*m的一塊地方,鋪a*a的磚,邊沿可以超出但是要保證鋪滿,求最少多少塊磚,直接看代碼 #include<stdio.h> #include<algorithm> using namespace std; int main() {

原创 Codeforces Round #335 (Div. 1) A. Sorting Railway Cars

題意:n個數編號1~n,現在給出亂序的n個數,其中任意一個數可以掉到序列頭或序列尾,最終使得這個序列按遞增的順利排列,也就是按照1~n排列,問最少需要操作多少次 貼代碼吧,直接套用最長遞增子序列的板子會超時,只能看着別人的去優化了,而且還

原创 Codeforces Round #334 (Div. 2) B. More Cowbell

題目鏈接:http://codeforces.com/contest/604/problem/B Description Kevin Sun wants to move his precious collection of n

原创 矩陣快速冪基本思想

教主傳授 快速冪的思想: 假設我們要求a^b,最樸素的方法就是不斷地乘a,乘b次,複雜度O(b)。 如果b很大,10^9,就需要用快速冪的思想。 例:a=3,b=100; 100的二進制爲:1100100 也就是100可以化成64+32+

原创 Codeforces Round #353 (Div. 2) A. Infinite Sequence

A. Infinite Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input

原创 Codeforces Round #353 (Div. 2) B. Restoring Painting

題目鏈接點擊打開鏈接 B. Restoring Painting time limit per test 1 second memory limit per test 256 megabytes input standar

原创 Codeforces Round #346 (Div. 2) C. Tanya and Toys

題目鏈接:點擊打開鏈接 C. Tanya and Toys time limit per test 1 second memory limit per test 256 megabytes input standard i

原创 HDU 3518 Boring counting(後綴數組入門題)

題目鏈接:點擊打開鏈接 Boring counting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total

原创 VK Cup 2012 Qualification Round 1 B. Taxi

n組人坐車,每組若干人,每個車不能超過4人,要求一組人必須坐在一起,不同組的也可以坐在一起,問最少需要多少輛車 貪心啦值得好好考慮一下 #include<stdio.h> #include<string.h> int main() {

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

題目鏈接:點擊打開鏈接 Scout YYF I Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6890   Accepted: 2004 Descrip

原创 C語言位運算

& 按位與 如果兩個相應的二進制位都爲1,則該位的結果值爲1,否則爲0| 按位或 兩個相應的二進制位中只要有一個爲1,該位的結果值爲1^ 按位異或 若參加運算的兩個二進制位值相同則爲0,否則爲1~ 取反 ~是一元運算符,用來對一個二進制數

原创 POJ 2096 Collecting Bugs (概率DP)

Collecting Bugs Time Limit: 10000MS   Memory Limit: 64000K Total Submissions: 4038   Accepted: 2013 Case Time Limit: 

原创 Codeforces Round #343 (Div. 2) B. Far Relative’s Problem

題目鏈接:點擊打開鏈接 B. Far Relative’s Problem time limit per test 2 seconds memory limit per test 256 megabytes in

原创 Codeforces Round #347 (Div. 2) B. Rebus

題目鏈接:點擊打開鏈接 B. Rebus time limit per test 1 second memory limit per test 256 megabytes input standard input

原创 HDU1403 Longest Common Substring(最長公共子串、後綴數組入門)

題目鏈接:點擊打開題目鏈接 Longest Common Substring Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot