大數加法

題目描述Now,we know that Yuanfang is the best student in the class. Every time when the teacher comes up with a hard problem and it seems no student can solve it, He always says: "Yuanfang , what do you think?".       Today, They had another math class,(

大數減法

http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2525比加法複雜,要考慮三種情況,n1>n2;  n1<n2;  n1=n2; #include<stdio.h>#include<string.h>int f(char st1[],char st2[]){    if(strlen(st1)>strlen(st2))        return 1; 

要學會有演算法寫出代碼

   通過這幾天的學習,我又找到了自己學習方法的不足:就是不會根據演算法寫出完整的代碼。今天學習了Dijkstra演算法,自己聽明白了,就是不能寫出完整的代碼。仔細想一想還是以前做的不好,才導致今天的下場---看著水題乾瞪眼。自己以前學習就是靠著整套代碼去理解演算法,開始是可以的,可是不能夠一直這樣下去。久之,你會發現你離開整套代碼就會寸步難行。在此,寫下自己的體會,希望對你們有所協助。

被此題坑了

#include<stdio.h>#include<string.h>int n;char st[100000],t[100];char trans(){ int a=0,b=1; for(int i=4; i>=0;i--) { if(t[i]>='0'&&t[i]<='9') { a+=b; } b*=2; } return

[HDU 3652]B-number[數位DP]

題意:求1到N之間含有13且能被13整除的數的個數.思路:數位DP. 注意求"整除"條件需要記錄餘數,即模.#include <cstdio>#include <cstring>using namespace std;int dp[12][15][2][12];int bit[12];//pos:處理的位元 num:模13餘數 t:是否已有13 e:當前尾數 flag:是否進入上限範圍int dfs(int pos, int num, bool t, int e,

[poj 3254]Corn Fields[狀壓DP]

題意:一塊玉米地,有的位置不能種草,種草的小方格不能有臨邊. 問有多少種方案.思路:狀壓DP.dp[ i ][ j ] 表示從上到下處理到第 i 行時, 該行狀態為 j 的方案數.下一行某狀態的方案數就是上一行所有合理狀態的方案數之和.注意初始化和最後一行的處理.#include <cstdio>#include <cstring>using namespace std;const int MAXN = 14;const int MOD = 1e8;typedef

[zoj 3551]Bloodsucker[機率DP]

題意:第0天有1個吸血鬼和n-1個人. 每天會有兩個個體相遇. 異種, 則p的機率, 人變吸血鬼.問給定p時, 人全部變成吸血鬼的天數期望.思路:機率DP.求期望一般是倒著算. 加上組合數公式.#include <cstdio>#include <cstring>using namespace std;const int MAXN = 1e5+5;double dp[MAXN],p;int n;int main(){ int T;

hdu 1317 XYZZY【Bellheman_ford 判斷正環小應用】

連結:http://acm.hdu.edu.cn/showproblem.php?pid=1317http://acm.hust.edu.cn/vjudge/contest/view.action?cid=29015#problem/FXYZZYTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1701    Accepted

POJ 1611 The Suspects【並查集入門】

The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 17149 Accepted: 8272DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To

POJ 2524 Ubiquitous Religions【並查集入門】

Ubiquitous ReligionsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 19292 Accepted: 9472DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out

POJ 2253 Frogger【最短路變形——路徑上最小的最大權】

連結:http://poj.org/problem?id=2253http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/DFroggerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 21206 Accepted: 6903DescriptionFreddy Frog is sitting on a stone in the middle of

POJ 1125 Stockbroker Grapevine【floyd簡單應用】

連結:http://poj.org/problem?id=1125http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22010#problem/EStockbroker GrapevineTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 23440 Accepted: 12854DescriptionStockbrokers are known to overreact

體力耗費

http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2100#include<cstdio>#include<iostream>#include<queue>using namespace std;int main(){ priority_queue<long long, vector<long long>,greater<long

hdu 1003 Max Sum【一維數組最大連續和】

連結:http://acm.hdu.edu.cn/showproblem.php?pid=1003http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28508#problem/AMax SumTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 113473    Accepted

[HDU 1548]A Strange Lift[Dijkstra最短路]

題意:電梯, 在第 i 層只能向上或向下走 ki 步, 問從 A 層到 B 層最少走多少步.思路:有向圖求最短路. 用Dijkstra, 都是正權值.注意:vector要清空 ! ! !  [ 淚目]#include <cstdio>#include <vector>#include <cstring>using namespace std;const int MAXN = 205;const int INF =

POJ 1050 To the Max【求最大的子矩陣和同上一篇數組中最大連續和】

連結:http://poj.org/problem?id=1050http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28508#problem/BTo the MaxTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 36968 Accepted: 19480DescriptionGiven a two-dimensional array of positive and

poj 2485 Highways

這是一道典型的最小產生樹的題目,給的是每個城市之間的距離,然後求最小產生樹中的最小的邊、、、用pirme加一點改正就可以很水的過掉啊、、、聲明一點我是聽我同學說的,然後拿劉汝佳的dijkstra改寫的,不得不說他的代碼真的是很簡約啊、、膜拜啊、、、HighwaysTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 18808 Accepted: 8723DescriptionThe island nation of

ACM集訓感想

   第一次進行ACM集訓,想寫一些自己的體會與感想,和大家分享。2013年1月18日,開始了我的集訓旅程。。。第一天,我身心疲憊,還被虐了,不過還是硬著頭皮堅持下來了。第二天,我有被打擊了,比賽題一道也沒A。中午老鄉要走我們聚了聚,這期間我說的最多的一句就是 我後悔了,我想和你一起回家。 老鄉也是一個勁的勸我,回到實驗室我看了一會“麻辣女兵”,上面一句話震撼了我:無論遇到多大的困難,都不能成為你放棄的理由。

poj 1258 Agri-Net

不多說了啊、、典型的最小產生樹啊、、、Agri-NetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 33507 Accepted: 13416DescriptionFarmer John has been elected mayor of his town! One of his campaign promises was to bring internet connectivity to all farms in the

HDU 1285 拓撲排序– 確定比賽名次

這麼水的拓撲排序竟然會逾時啊、、哭了啊、變數在裡面定義的竟然逾時了啊、、拿出來就對了啊,還有啊,這個得判重邊啊、、一定要判啊!Description有N個比賽隊(1<=N<=500),編號依次為1,2,3,。。。。,N進行比賽,比賽結束後,裁判委員會要將所有參賽隊伍從前往後依次排名,但現在裁判委員會不能直接獲得每個隊的比賽成績,只知道每場比賽的結果,即P1贏P2,用P1,P2表示,排名時P1在P2之前。現在請你編程式確定排名。 Input輸入有若干組,每組中的第一行為二個數N(1&l

總頁數: 61357 1 .... 19228 19229 19230 19231 19232 .... 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.