原创 北京化工大學2018年10月程序設計競賽 Problem D

題目描述 我懶得編故事了 m哥牛逼! 有n個積木,第i個積木的高度爲a[i],求每個積木前面有幾個比它矮的積木 輸入 多組輸入,每組由兩行組成,第一行輸入n,第二行輸入n個數,爲n個積木的高度a[i] //(1<=n<=100000

原创 洛谷P1980 計數問題

題目描述 試計算在區間 1 到 n 的所有整數中,數字 x(0 ≤ x ≤ 9)共出現了多少次?例如,在 1到11中,即在 1,2,3,4,5,6,7,8,9,10,11 中,數字 1 出現了 4 次。 輸入輸出格式 輸入格式: 2個

原创 北京化工大學2018年10月程序設計競賽 Problem B 求素數

輸入 共兩行: 第一行爲N何L,中間用空格隔開。 (1<=N<=100 , 1<=L<=7) 第二行爲N個0~9的數字,中間用空格隔開。 輸出 只有一行,含全部滿足條件的素數,中間用逗號隔開,保證至少存在一個素數。 樣例輸入 10

原创 uva 11624 Fire!

先bfs火,存儲火的位置及時間的關係,放入隊列,再bfs人 #include<stdio.h> #include<iostream> #include<algorithm> #include<string> #include<st

原创 poj-3984 迷宮問題

定義一個二維數組: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, };

原创 HDU-2050 折線分割平面

我們看到過很多直線分割平面的題目,今天的這個題目稍微有些變化,我們要求的是n條折線分割平面的最大數目。比如,一條折線可以將平面分成兩部分,兩條折線最多可以將平面分成7部分,具體如下所示。 Input 輸入數據的第一行是一個整數C,表

原创 HDU 2084 數塔 DP

在講述DP算法的時候,一個經典的例子就是數塔問題,它是這樣描述的: 有如下所示的數塔,要求從頂層走到底層,若每一步只能走到相鄰的結點,則經過的結點的數字之和最大是多少? 已經告訴你了,這是個DP的題目,你能AC嗎? Input 輸入

原创 HDU 2602 Bone Collector

Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies

原创 zoj4016 Mergeable Stack

Given initially empty stacks, there are three types of operations: 1 s v: Push the value onto the top of the -th stac

原创 hihoCoder #1174:拓撲排序·一

描述 由於今天上課的老師講的特別無聊,小Hi和小Ho偷偷地聊了起來。 小Ho:小Hi,你這學期有選什麼課麼? 小Hi:挺多的,比如XXX1,XXX2還有XXX3。本來想選YYY2的,但是好像沒有先選過YYY1,不能選YYY2。 小Ho

原创 HDU 6282 String Transformation

Bobo has a string S=s1s2…sn consists of letter a, b and c. He can transform the string by inserting or deleting subs

原创 HDU 4513 吉哥系列故事——完美隊形II(Manacher)

吉哥又想出了一個新的完美隊形遊戲!   假設有n個人按順序站在他的面前,他們的身高分別是h[1], h[2] ... h[n],吉哥希望從中挑出一些人,讓這些人形成一個新的隊形,新的隊形若滿足以下三點要求,則就是新的完美隊形:   

原创 HDU 1014 Uniform Generator

Computer simulations often require random numbers. One way to generate pseudo-random numbers is via a function of the

原创 CodeForces 1025C Plasticine zebra

Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while s

原创 ACM/ICPC 2018亞洲區預選賽北京賽站網絡賽 題目4 : 80 Days

時間限制:1000ms 單點時限:1000ms 內存限制:256MB 描述 80 Days is an interesting game based on Jules Verne’s science fiction “Around t