poj 1922 Ride to School

/*1,時間為負數的不用管,直接去掉,因為如果你可以追得上他(A),那麼說明你的速度比他快,那麼你不會去跟他(A)走的,如果追不上,那更加不用說2,找一個達到時間最少的,輸出這個答案就行了,,因為用時最少那麼他一定會追上你,你一定會最後跟著他走,他到達的時間也就是你達到的最少時間了(這裡的t=s/v+t0)3,精度問題,比如得到1.1,你就應該輸出2,那麼就是if(aa-(int)aa>0.0)的問題了*/#include <iostream>#include

poj 1477 Box of Bricks

//這題只是讓你求給出的數的平均數即可!再通過續一比較,不夠平均數的就從多於平均數中補上! #include <iostream>using namespace std;int num[55];int main(){ int n, i, tc = 0, sum, avg, ans; while (cin >> n) { if (n == 0) break; tc++; sum = ans = 0;

poj 1786 Bridge Hands

//比較簡單的一道類比題,類比撲克牌的派發! #include <iostream>#include <string>#include <vector>#include <cctype>#include <algorithm>#include <map>using namespace std;struct Info//撲克牌的牌面 { char num; char color;}card;//各個選手的牌

面試訓練複雜鏈表的複製

題目:有一個複雜鏈表,其結點除了有一個m_pNext指標指向下一個結點外,還有一個m_pSibling指向鏈表中的任一結點或者NULL。其結點的C++定義如下:               struct ComplexNode{   int m_nValue;   ComplexNode* m_pNext;   ComplexNode*

poj 1484 Blowing Fuses

//這題貢獻了兩次RE,因為我開始是這樣想的:只要在輸入的過程中,有fuse大於其c值的,就中斷輸入,直接輸出結果就結束,誰知道RE了! #include <iostream>using namespace std;struct Info{ int fuse; bool state;}devices[30];int main(){ int n, m, c, i, j, op, ans, sum, tc = 0; bool flag; while

poj 1118 Lining Up

//判斷共線的最大點數有多少個?!根據斜率判斷,為避免斜率不存在的情況,改為乘法比較簡單一點! #include <iostream>#include <climits>using namespace std;struct Info{ int x; int y;}cor[705];int main(){ int n, i, j, k, ans, max; double k1, k2; while (cin >> n) {

poj 2606 Rabbit hunt

//同題目1118的原理是一樣的!只是改一改輸入就可以了! #include <iostream>#include <climits>using namespace std;struct Info{ int x; int y;}cor[205];int main(){ int n, i, j, k, ans, max; cin >> n; ans = 0; max = 0; for (i = 1;

poj 1493 Machined Surfaces

//讀懂題意:將左邊的字串與右邊的字串進行合并,以最長的作為標準,問其餘的合并時候剩餘的空格! 題目中第一個例的合并之後的形式: //XXXX XXXXX//XXXXXXXXXX//XXXXX XXXX//XX XXXXXX//求中間剩餘的空格數! #include <iostream>#include <string>#include <algorithm>using namespace std;string input[15];int

poj 3672 Long Distance Racing

//給出總的路程,然後再選擇訓練的地圖,記得去的時候,如果是上坡的,返回的時候就變成了下坡,如果是下坡的,返回的時候就變成了上坡!//總之路程就是雙程!問最多可以有幾個地圖可以選擇的! #include <iostream>#include <string>using namespace std;char unit[100005];int main(){ int m, t, u, f, d, i, ans = 0, sum = 0; cin >>

poj 1658 Eva’s Problem

#include <iostream>using namespace std;int main(){ int tc, num[5], tmp[3]; cin >> tc; while (tc--) { cin >> num[0] >> num[1] >> num[2] >> num[3]; tmp[0] = num[1] - num[0]; tmp[1]

poj 2840 Big Clock

//通過讀鐘錶上面的點數,計算出需要strike的次數,很簡單,將字串轉換為數字就OK! #include <iostream>#include <string>using namespace std;int main(){ int tc, len, i, j, h, m; string time; cin >> tc; while (tc--){ cin >> time; h = m =

poj 3158 Kickdown

/*說說題意吧,我用另一種方式來說,情節可能和原題不同:你可以理解為,生產了兩種齒輪,2表示凸齒、1表示凹槽,凸齒處高度為2h,凹槽處高度為1h,現在有一個高度為3h的盒子,要去裝這兩個齒輪,問至少要多長才可以裝得下,要求兩個齒輪不可以橫向翻轉。分析題意:如果兩個齒輪剛剛好嚴絲合縫的可以拼湊在一起,那麼他們的總高度就是3h,如輸入範例#2: 1212121221212121 則,這兩個齒輪拼湊在一起,長度為8,高度為3h,只需要一個長度為8的盒子就可以了。

poj 2665 Trees

//給出一段距離,即是樹木的總數,然後再給出幾個樹木需要砍伐或者移走的地區,求剩下的樹木數!注意://That's to say that there used to be 301 trees on the road. Now the section from 100m to 200m //is assigned for subway station, so 101 trees need to be moved away and only 200 trees are left.

poj 3096 Surprising Strings

//這題的測試資料很水,以為下面的做法會逾時的!呵呵! 題意:在一個字串中,給出一些字元間的距離,然後//讓你根據這距離再重新組成字串,檢查是否有相同的字串存在! #include <iostream>#include <string>#include <vector>using namespace std;vector<string> v;int main(){ string str, tmp; int i, len, d, j,

poj 3183 Stump Removal

//這題需要注意邊界的處理!就開始我以為需要用動態規劃做的,誰知道這題只是需要從頭到尾進行//一次掃描即可,找出每一個高峰點就OK!哎,將簡單的問題複雜化了,歸根是沒有真正讀懂題意! #include <iostream>using namespace std;int h[50050];int main(){ int n, i; cin >> n; for (i = 1; i <= n; i++){ cin >> h[i]

poj 3117 World Cup

//仔細分析題意之後,就會覺得這是一道好簡單的題:贏球得3分,輸球得0分,平局得1分!現在假設有3場球賽://如果沒有輸球的球隊,則總的分數為9分,如果有一場是平局的情況下,則總的分數為:平局的2分加上贏球的3*2,總共為8分;//如果有二場是平局的情況下,則總的分數為:平局的2*2加上贏球的3*1,總共為7分,按照這樣的規律分析下去,結果就出來了! #include <iostream>#include <string>using namespace

poj 2664 Prerequisites?

//給出選擇的科目和分類,看選課是否達標! #include <iostream>#include <string>using namespace std;int course[110];bool flag[110];int main(){ int k, m, c, r, i, j, l, tmp, ct; bool ff; while (cin >> k){ if (k == 0) break;

poj 1657 Distance on Chessboard

//簡單的類比題,需要對每一個走子的規則有一個全面而準確的類比,很容易漏掉情況! #include <iostream>#include <cmath>#include <string>using namespace std;int main(){ int tc, x, y; string pos1, pos2; cin >> tc; while (tc--) { cin >> pos1

poj 3300 Tour de France

/*題意:單車用鏈條將兩個齒輪,前面的齒輪由2或3根齒條組成,後面的齒輪由5……10根齒條組成,這齒輪轉動的角速度d是由前後兩個齒輪所包含的齒條數決定的,假設前面的齒輪的齒條數為m,後面齒輪的齒條數為n,那麼角速度為n/m,求出所有d後將其按升序排序,然後再計算d[i+1]/d[i]的最大值.*/#include <iostream>#include <algorithm>#include <cstdio>#include

poj 1326 Mileage Bank

#include <iostream>#include <string>using namespace std;int main(){ string str1, str2, str3; int m, ans = 0; while (cin >> str1) { if (str1 == "0") { cout << ans << endl;

總頁數: 61357 1 .... 19891 19892 19893 19894 19895 .... 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.