摘要:
寫這個程序的時候有三個關(guān)鍵點,知道了這個,你Win, Or, 你Lose!我將它們一一注釋在了代碼中。View Code #include "iostream"#include "cstring"#include "string"using namespace std;#define maxlen 200int a[maxlen]; int b[maxlen]; int c[2*maxlen+1]; //這個地方也是個關(guān)鍵,一定要多加一個正數(shù),不然錯string s1;string s2;int main(){ while(cin&g
閱讀全文
摘要:
#include "iostream"#include "string"#include "cstring"using namespace std;#define maxlen 2001int a[maxlen];int b[maxlen];int len1, len2, i, j;int bigger(int a, int b){ return a>b?a:b;}void Add(int underzero){ if(underzero) cout<<'-'; int big = bigger(le
閱讀全文
摘要:
#include<iostream>#include<string>#include<cstring>using namespace std;#define maxlen 200int a[maxlen];int b[maxlen];int bigger(int a, int b){ return a>b?a:b;}int main(){ string s1, s2; while(cin>>s1>>s2) { int len1 = s1.length(); int len2 = s2.length(); memset(a, 0,
閱讀全文
摘要:
DescriptionBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get back as quickly as possible.Farmer John's field has N (2 <= N <= 1000) landmarks
閱讀全文
摘要:
題目:http://poj.org/problem?id=3259題目大意:一個famer有一些農(nóng)場,這些農(nóng)場里面有一些田地,田地里面有一些蟲洞,田地和田地之間有路,蟲洞有這樣的性質(zhì): 時間倒流。問你這個農(nóng)民能不能看到他自己,也就是說,有沒有這樣一條路徑,能利用蟲洞的時間倒流的性質(zhì),讓這個人能在這個點出發(fā)前回去,這樣他就是能看到他自己了 其實要想搞明白這道題目十分的簡單,但前提是,你看了我的“Dijkstra算法解決POJ 2263”這篇文章,其余的也就不多說了,該說的我都在注釋中說明白了。View Code #include<iostream>using namespace st
閱讀全文
摘要:
DescriptionBig Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the Godzilla V12, is so big that the amount of cargo you can transport with it is never limited by the truck itself. It is only limited by the weight restrictions that apply for the roads al
閱讀全文
摘要:
題目:http://poj.org/problem?id=2263題目大意:有n個城市,r條連接兩個城市的道路,每條道路有自己的最大復(fù)載量?,F(xiàn)在問從城市cst到城市cen,車上的最大載重能為多少。雖然是提交了,也搞懂了,但是還沒有徹底的明白。因此,也不便多說什么,當(dāng)我徹底明白的時候再說吧。呵呵,終于完全的明白了,下面指出一二。1.一定要明白map[][]的雙關(guān)性,何為雙關(guān)? (1).map[i][j]表示i到j(luò)的距離 (2).map[i][j]=0表示i到j(luò)不可以直接可達(dá) 要達(dá)到這種效果,首先將map[][]全部賦值為0, 然后存儲建圖,在建圖的過程中自然的將直接可達(dá) 的兩點賦值為不...
閱讀全文
摘要:
DescriptionRisk is a board game in which several opposing players attempt to conquer the world. The gameboard consists of a world map broken up into hypothetical countries. During a player's turn, armies stationed in one country are only allowed to attack only countries with which they share a c
閱讀全文
摘要:
DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of up to 100,000 dictionary entries, followed by a blank line, followed by a message
閱讀全文
摘要:
題目:http://poj.org/problem?id=2503就是一個字典樹的簡單應(yīng)用, 不解釋。View Code #include "iostream"using namespace std;typedef struct node{ char word[21]; int mark; struct node * next[26];}node;node * root;void InitRoot(){ root = new node(); root->mark=0; memset(root->next, NULL, sizeof(root->next))
閱讀全文