CF 1A1B 兩個水題(簡單思維+細心)

A. Theatre Squaretime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputTheatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's

Codeforces Round #194 (前兩題)

A. Candy Bagstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGerald has n younger brothers and their number happens to be even. One day he bought n2 candy bags. One bag has one candy, one bag has

01背包 hdu2660

/* 這道題目有點變形,就是他給定了最多裝多少個。 所以多了一個迴圈。 dp也變成了二維的。*/#include<iostream>#include<cstdio>#include<cstring>using namespace std;int dp[1002][21],i,j,vol,k,l;int cos[1002],wei[1002];int maxx(int a,int b){return a>b?a:b;}int main(){

HDU 1131Count the Trees(卡特蘭數 大數)

Count the TreesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1255    Accepted Submission(s): 818Problem DescriptionAnother common social inability is known as ACM (Abnormally Compulsive

HDU 1250Hat’s Fibonacci(兩種方法處理大數)

Hat's FibonacciTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5891    Accepted Submission(s): 1944Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the

hdu4490 Mad Veterinarian(簡單bfs)

Mad VeterinarianTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 168    Accepted Submission(s): 58Special JudgeProblem DescriptionMad Veterinarian puzzles have a mad veterinarian, who has

hdu4488 Faulhaber’s Triangle(類比)

Faulhaber’s TriangleTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 124    Accepted Submission(s): 55Problem DescriptionThe sum of the mth powers of the first n integersS(n,m) = SUM ( j= 1 to n)

poj1117 Pairs of Integers(簡單dfs)

Pairs of IntegersTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3622 Accepted: 905DescriptionYou are to find all pairs of integers such that their sum is equal to the given integer number N and the second number results from the first one

HDU4335—–What is N?—–數論

題目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4335題目意思:給你三個數b,p,m問你滿足0<=n<=m 且n^n!%p==b的n有多少個解題思路:主要考察a^x % c = a^(x % phi(c) + phi(c))  %c  其中x>= phi(c)phi(c)為歐拉函數第一部分  n! < phi(c)  這時就需要直接計算n! ,好在phi(c)不會很大。第二部分 n! >= phi(c) 但是 n! %

UVA1424—-Salesmen—-動態規劃

題目地址:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4170題目意思:給你一個有N1個點的無向連通圖,N2條邊然後給你一個數字序列,這些數字都是前面的那N1個點要你修改序列盡量少的數字,使得序列中任意相鄰的兩個數要麼相同,要麼在圖中有邊連通解題思路:給出轉移方程設dp[i][j]表示從1~i的序列以j結尾的修改次數那麼if(j

暴力dfs POJ1426

/* 題目地址:http://poj.org/problem?id=1426點擊開啟連結 題目大意:找出僅用0和1 組成的十進位的數構成是出入n的倍數(n<=200) 解題思路:有人直接打表打了200個,因為並不像想的那樣資料那麼大,有的直接用數學原理。

hdu1754 I Hate It(splay或者線段樹)

I Hate ItTime Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 27434    Accepted Submission(s): 10889Problem

POJ 3899 幸運數第一次積分賽H題

/*    第一次積分賽的幸運數問題,很糾結的打出來了,然後找規律.    這道題目還是真的沒那麼容易消化。。。    題目地址:The Lucky Numbers#include<cstdio>#include<cstring>#include<iostream>#include<cmath>#include<algorithm>using namespace std;__int64 p[50];char str1[50], str2

ZOJ3080 ChiBi FLOYD

並查集維護聯通性每一個聯通快枚舉點燃的船隻,然後求出全部燒著的最小時間最後求出所有聯通塊燒著時間的最大值即可。ChiBiTime Limit: 5 Seconds      Memory Limit: 32768 KBwatashi's mm is so pretty as well as smart. Recently, she has watched the movie Chibi. So she knows more about the War of ChiBi. In the war,

hdu4614 Vases and Flowers(簡單線段樹 + 二分)

Vases and FlowersTime Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1336    Accepted Submission(s): 532Problem Description  Alice is so popular that she can receive many flowers everyday. She has

HDU4336 Card Collector 機率+容斥

求得到n張卡的期望。Card CollectorTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1700    Accepted Submission(s): 776Special JudgeProblem DescriptionIn your childhood, do you crazy for collecting the

UVA1099—-Sharing Chocolate—-在集合上的DP

題目地址:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3540題目意思:給你一塊X*Y的巧克力問你是否可以分成N塊大小分別為AI的小巧克力解題思路:我們用F[X][S]表示能否分成將一個小邊為X且集合為S切的時候分兩種,橫切和豎切橫切則是X不變,豎切則是Y不變,可以切成兩個子集,按記憶化搜尋對於那些x*y不等於sum[s]的我們

HDU4388 Simple Path 雙聯通+LCA

一開始用LCT查詢和,果斷跪了。。。。以後不修改圖結構的東西還是就用rmqLCA比較好(其實還忘記了有樹鏈剖分,但是查詢l時間真的太傷了)問一張圖中從起點到終點每一個點只能走一遍,有毒少點不能走到。先對原圖求雙聯通分量,然後縮點成新圖。注意。要建成連通分量和割點相領的圖;然後添加ROOT(有利於rmqLCA),然後只要求出u和v的lca最後

HDU3613—–Best Reward—–用擴充KMP來判斷某個串是不是迴文串

題目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3613題目意思:給你一個字串S,然後會告訴你每種字母的值讓你把S分成兩個子串,若子串是迴文串,則價值等於字母價值之和,不然為0問你最大價值解題思路:枚舉分開的點,然後對前後兩個子串進行判斷是否是迴文串,然後算出值,求出最大值即可比較難搞的就是怎麼判斷迴文串,如果用暴力的話就太那個啥了所以這題用到了擴充KMP例如一個串a0 a1 a2a3a4 ...an-1an-1 an-2 an-3 an-4 an-

HDU3486—-Interviewe—-二分+一維RMQ

題目地址:http://acm.hdu.edu.cn/showproblem.php?pid=3486題目意思:給定n個數的序列,讓我們找前面k個區間的最大值之和,每個區間長度為n/k,如果有剩餘的區間長度不足n/k則無視之。現在讓我們找最小的k使得和嚴格大於m。n<=20萬,m <=

總頁數: 61357 1 .... 19632 19633 19634 19635 19636 .... 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.