zoj 2376 Ants

/*思路:最短時間容易的,最長時間,關鍵要注意到每個螞蟻速度是一樣的,作圖 通過距離的等價替換可以發現我們要求的其實就是(最右邊的螞蟻-左終點) 和(右終點-最左邊的螞蟻)的較大值*/#include "iostream"#include "algorithm"using namespace std;int main(){int testcase, temp, i, maxlen, minlen, mid, ans, m, n;cin >>

zoj 1797 Least Common Multiple

//求最小公倍數!對輸入的資料一對一對的進行求解,再與輸入的第三個資料進行求解即可!#include "iostream"#include "algorithm"using namespace std;int main(){int testcase, num, i, j, temp1, temp2, temp3;cin >> testcase;while (testcase--){cin >> num;cin >> temp1;for (i = 1; i

zoj 2433 Highways

#include <cstdio>#include <climits>#include <cstring>#include <iostream>using namespace std;int main(void){int ncase,n;int a[51000];while(cin>>ncase){while(ncase--){cin>>n;for(int

poj 1298 The Hardest Problem Ever

//第一次竟然因為map的映射中寫錯了一個而WA了一次,哎,粗心! #include "iostream"#include "string"#include "map"#include "cctype"using namespace std;map<char, char> m;int main(){ m['A'] = 'V', m['B'] = 'W', m['C'] = 'X', m['D'] = 'Y', m['E'] = 'Z', m['F'] = 'A',

zoj 1713 Haiku Review

//這題屬於字串簡單題,就是找出輸入字串的母音字元(a, e, i, o, u, y),//連續兩個母音當做一個母音來計算!// If the haiku is not correct, you must output the number of the first line that has the wrong number of syllables.//一開始WA了一次,就是錯解了這一句,多輸出了一個數!#include "iostream"#include

poj 2271 HTML

#include "iostream"#include "string"using namespace std;int main(){ string input; int countnum = 0, i; while (cin >> input) { if (input == "<br>") { cout << endl; countnum =

poj 1835 宇航員

//這一類比題,我之前有接觸過,我記得剛開始不會做,然後看了別人的代碼,然後再自己寫一遍出來,現在再來做的時候,發現自己原來還不會做,所以這次我沒有看別人的代碼,完全靠自己//的思考解決了這一題!事實證明:沒有經過自己思考的東西是記不住和學不會的,以後需要勤動動腦才可以!謹記!//最開始我思考這一類比題的時候,卡住我思路的是:一直想將宇航員的狀態在數組中一一表示出來,然後就可以輕鬆的求出他的座標了,到後來再詳細分析的時候,才發現宇航員的狀態是會隨著上一次的狀態的改變而改變的! #include

zoj 1716 Get Many Persimmon Trees

//這題主要是給定一個矩形的寬度和高度,在給出的這個矩形的面積中,//求出包含最多的樹的數目,最開始WA了很多次,因為沒有考慮到取值的範圍!//下面主要用枚舉的方法,一個一個的矩形進行枚舉!#include "iostream"#include "memory.h"#include "algorithm"using namespace std;struct treespos{int width;int height;};int main(){int treesnum, i, j, k,

poj1676 What time is it?

//這一題真是耗盡了腦汁也找不出WA在哪!?(好打擊人的一題) //我的思路是:將輸入的LED時鐘還原為數字,然後再一一進行匹配,過程可以進行一些剪枝操作(例如第一個數字不可以大於2,第三個數字不可以大於6)//得出了第一個時鐘的正確時間,然後再減去15分鐘,得出第二個時鐘的時間,再在第二個時鐘的字串中尋找是否存在著這些數字,如果存在,匹配數就加1//到最後如果匹配數大於1又或者為0,就輸出not sure,否則就輸出正確的時間!

zoj 1067 Color Me Less

#include "iostream"#include "vector"using namespace std;struct color{int R;int G;int B;};int main(){int i;color input;vector<color> v;vector<color>::iterator it;for (i = 0; i < 16; i++){cin >> input.R >> input.G >>

zoj 1402 Magnificent Meatballs

#include "iostream"#include "memory.h"using namespace std;int meatballs[40];int main(){int guestnum, i, j, sum1, sum2;while (cin >> guestnum && guestnum){memset(meatballs, 0, sizeof(meatballs));sum1 = sum2 = 0;for (i = 0; i <

poj 1281 MANAGER

//這題屬於簡單的類比題,主要是用兩個容器來儲存增加進來的cost和刪除的cost即可!然後再根據給出的刪除清單,在儲存刪除的容器中進行!//就開始的時候WA了一次,是因為輸出格式的問題,值得注意! #include "iostream"#include "string"#include "set"#include "vector"using namespace std;multiset<int> s;//增加cost的儲存 vector<int>

zoj 1115 Digital Roots

//剛開始做這題的時候,以為是一題好簡單好簡單的題,但是我卻無考慮到當輸入的數為非常大的時候這種情況!//思考還是不夠周密!要加強鍛煉才可以!#include "iostream"#include "string"using namespace std;int root (int n){if (n < 10)return n;else{int temp = n, ans = 0;while (temp){ans += temp % 10;temp /= 10;if (temp == 0){

poj 1007 DNA Sorting

#include "iostream"#include "string"#include "algorithm"using namespace std;struct Info{ string str; int count;}info[110];bool cmp(Info a, Info b){ return a.count < b.count;}int main(){ int len, num, i, j, k; cin >> len >&

zoj 1090 The Circumference of the Circle

//利用餘弦和正弦公式就可以很容易求出半徑了!#include "iostream"#include "cmath"#include "cstdio"using namespace std;const double pi = 3.141592653589793;int main(){double x1, y1, x2, y2, x3, y3;double a2, b2, c2, r;while (cin >> x1 >> y1 >> x2 >>

poj 1016 Numbers That Count

//由於使用了c++,所以逾時了,改為c語言才可以! #include "iostream"#include "string"#include "memory.h"#include "vector"#include "sstream"using namespace std;int c[10];vector<string> v;//儲存15個字串轉換的結果 string countnum(string str)//將字串進行轉換 { string ans;

zoj 1405 Tanning Salon

#include "iostream"#include "string"using namespace std;int main(){int beds, i, len, size, count, pos;string ans, customers, temp;while (cin >> beds && beds){cin >> customers;len = customers.length();count =

zoj 1879 Jolly Jumpers

#include "iostream"#include "memory.h"#include "cmath"using namespace std;int num[3010], ans[3010];int main(){int n, i;bool tag;while (cin >> n){tag = false;if (n == 1){for (i = 1; i <= n; i++)cin >> num[i];cout << "Jolly"

poj 2262 Goldbach’s Conjecture

//打表的時候竟然TLE,好囧啊!以為可以節省時間的!//poj上面的題目就是比別的oj上的題目要難!加油! #include "iostream"#include "cmath"#include "memory.h"using namespace std;bool is_primer(int num){ int i, n; if (num == 1 || num == 0) return 0; n = sqrt(double (num)); for (i = 2

poj 1005 I Think I Need a Houseboat

//給出兩點座標, 求出半徑,求面積就可以!簡單題! #include "iostream"#include "cmath"using namespace std;const double pi = 4.0 * atan(1.0);const int d = 50;int main(){ int tc, count = 0, ans; double x, y, area; cin >> tc; while (tc--) { count+

總頁數: 61357 1 .... 19895 19896 19897 19898 19899 .... 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.