CF-192-diy-2

題目連結:http://codeforces.com/contest/330A.

hdu-4519-二分-鄭廠長系列故事——體檢

題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=4519題目大意:有n個人體檢,每個人要檢查k個項目,有m個醫生,每個醫生檢查每個人的一個項目需要花費1分鐘,問你檢查完所有的人最少需要花費多長時間。要求:每個醫生每次只能檢查一個人的一個項目,每個人同一分鐘只能接受一個醫生檢查一個項目。解題思路:很容易想到二分。每個人都有k個項目,顯然最小的時間為k分鐘,如果比k小的話,肯定存在同一分鐘有一個人檢查了超過兩個項目,不和題意。考慮最壞的情況,只有一個醫生

HDU 3609Up-up(層層遞推降冪+蛋疼的特判)

Up-upTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1485    Accepted Submission(s): 420Problem DescriptionThe Up-up of a number a by a positive integer b, denoted by a↑↑b, is recursively

poj 2870 Light Up (dfs+強剪枝)

Light UpTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 737 Accepted: 285DescriptionLight Up is a puzzle set in a rectangular board divided in smaller squares. Some squares in the board are ``empty'' (white squares the figure below), some

HDU 4550卡片遊戲(貪心)

卡片遊戲Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 841    Accepted Submission(s): 263Problem

D. Psychos in a Line Codeforces Round #189 (Div. 2)

D. Psychos in a Linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n psychos standing in a line. Each psycho is assigned a unique integer from 1 to n. At each step every psycho who has

hdu 1044 Collect More Jewels (兩種解法 1.bfs+狀壓 2.bfs+dfs)

Collect More JewelsTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3545    Accepted Submission(s): 703Problem DescriptionIt is written in the Book of The Lady: After the Creation, the cruel god

Problem I hdu 1053 Entropy

EntropyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2962 Accepted Submission(s): 1121Problem DescriptionAn entropy encoder is a data encoding method that achieves lossless data compression by

poj 2049 Finding Nemo 建迷宮預先處理+優先隊列bfs

Finding NemoTime Limit: 2000MS Memory Limit: 30000KTotal Submissions: 6767 Accepted: 1546DescriptionNemo is a naughty boy. One day he went into the deep sea all by himself. Unfortunately, he became lost and couldn't find his way home. Therefore, he

poj-3897-Maze Stretching 二分+BFS+優先隊列

題目連結:http://poj.org/problem?id=3897題目意思:求豎直伸縮比例,使得從起點到終點的距離最小值恰好等於給定值。未伸縮前水平和豎直的步長都為1。解題思路:二分伸縮比例,用BFS求在該豎直長度下的最短距離,直到該距離等於給定值。搜尋的時候,用優先隊列來確定搜尋位置,使得每次搜尋都是從距離開始點的最短距離開始往後搜代碼:#include<iostream>#include<cmath>#include<cstdio>#include&l

hdu 1068 Girls and Boys

Girls and BoysTime Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5528    Accepted Submission(s): 2466Problem Descriptionthe second year of the university somebody started a study on the romantic

hdu 4268 Alice and Bob (set+貪心)

Alice and BobTime Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1796    Accepted Submission(s): 641Problem DescriptionAlice and Bob's game never ends. Today, they introduce a new game. In this

儲存現場的BFS-hdu-2128-Tempter of the Bone II

題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=2128題目意思:在一個矩陣中,給一個起點一個終點,矩陣中有的位置有牆,有的位置有炸彈,對於牆必須拿炸彈炸才能過,每走一步花費1s,每炸一次門花1s,問從起點到終點的最短時間。解題思路:BFS。(DFS會逾時)因為地圖會變,所以普通的BFS,不行。必須要儲存現場,使得之前不能到達的路徑對地圖的改變能夠還原,使得對後面的正確路徑無影響。又對於矩陣任意位置,要麼可走(1),要麼不可走(0)。所以可以用二進位

Problem E Codeforces Round #184 (Div. 2) B. Continued Fractions

B. Continued Fractionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA continued fraction of height n is a fraction of form . You are given two rational numbers, one is represented as  and the

KMP hdu-2594 Simpsons’ Hidden Talents

題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=2594題目意思:給兩個串,求出第一個串的首碼是第二個串的尾碼的最大長度。解題思路:先求出第一個串的next數組,然後來匹配第二個串。注意一種特殊情況,當第二個串是第一個串的首碼子串時,next數組不能包括自己本身。單獨處理。代碼:#include<iostream>#include<cmath>#include<cstdio>#include<cstdlib&

Codeforces Round #188 (Div. 2) B. Strings of Power

B. Strings of Powertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVolodya likes listening to heavy metal and (occasionally) reading. No wonder Volodya is especially interested in texts

poj 1768 Hang or not to hang 離散化+搜尋+狀態壓縮

題目連結:http://poj.org/problem?id=1768題目意思:給你n種命令,最多32個寄存器,問可能的最少的執行命令次數,使程式終止。解題思路:對於不能直接和間接影響JZ中的寄存器的寄存器的狀態可以是任意,因為他們每一步都是確定的,最終命令執行的次數與初始狀態無關。所以先找出直接和間接影響JZ中的寄存器的寄存器,由於命令最多隻有16個,所以除去STOP和JZ,最多隻有14個命令,影響的寄存器最多隻有16個。比如命令 AND a b

機率dp ural 1776. Anniversary Firework

題目連結:http://acm.timus.ru/problem.aspx?space=1&num=1776題目意思:要把1-n個火箭都點火,其中每次點火間隔10s.點火步驟:1、首先點燃第一個和最後一個2、點燃任意兩個已點火箭的中間一個。注意可以有多個區間,每次可以同時點燃多個。求點燃所有火箭的時間的期望。解題思路:比賽的時候想簡單了,認為左邊的時間期望和右邊的時間期望的最大值就是此時下一步的時間期望,被虐了。應該根據期望=機率乘以時間,用dp[i][j]表示恰好點燃i個火箭花j個十秒

資料結構 uva 112-Tree Summing

 題目連結:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=48 題目意思:用括弧方式給你一顆二叉樹,一個預期的值result,如果從根到葉子節點所有的節點的值的和能夠等於result,則輸出yes,否則輸出no. 解題思路:由於題目給的是有任意空格和斷行符號,所以先把括弧和數字全部存入到字元數組中,跳過空格和斷行符號,然後再處理,

hdu 1693 Eat the Trees 輪廓線 插頭dp

題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=1693題目意思:給n*m的方格,有些方格有障礙,問有多少種方式能使所有的非障礙點都在某個環上,環可以有多個。解題思路:輪廓線dp.dp[i][j][s]表示到達第i行第j列,輪廓線上插頭的狀態為s時的總的方案數。對於當前第j列,狀態(bool) s&(1<<j)表示當前格的右插頭,(bool)

總頁數: 61357 1 .... 19627 19628 19629 19630 19631 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.