zoj 2876 Phone List

//這題需要先將給出的數字當字串輸入,然後再進行字串的排序,最後在字串中進行字串的尋找!#include "iostream"#include "string"#include "vector"#include "algorithm"using namespace std;int main(){int TestCase;cin >> TestCase;while (TestCase--){int num;vector<string> v;vector<string&

poj 2141 Message Decowding

#include "iostream"#include "map"#include "string"#include "cctype"using namespace std;map<char, char> m;int main(){ string input, key; int len, i; cin >> key; cin.get(); len = key.length(); for (i = 0; i < len; i++)

zoj 1730 Crazy Tea Party

//水題不水啊!/*類似冒泡程式 如果所有人是線性排列,那我們的工作就是類似冒泡程式做的工作:1,2,3,4,5變為5,4,3,2,1 ,耗時n(n-1)/2 但是出現了環,也就是說1,2,3,4,5變為3,2,1,5,4也可滿足條件 我們可以把這個環等分成兩個部分 ,每個部分看成是線性,再把它們花的時間加起來. 當n是偶數時, 每份人數n/2 ,即 2*(n/2 )*(n/2 -1)/2; 當n是奇數時,兩份的人數分別是n/2和n/2+1,即(n/2)*(n/2 -1)/2 + (n/2 +

zoj 2481 Unique Ascending Array

//這題主要是在給出的數組中找出不重複的數,並按升序的順序排序起來!很簡單! #include "iostream"#include "algorithm"#include "memory.h"using namespace std;int num[110], ans[110];int main(){ int N, i, j; while (cin >> N && N) { memset(num, 0, sizeof(num));

poj 2070 Filling Out the Team

#include "iostream"#include "string"using namespace std;struct Info{ string pos; double speed; int weight; int strength;};int main(){ bool flag; double sp; int w, s, i; Info info[3]; info[0].pos = "Wide Receiver",

zoj 2476 Total Amount

//這題主要是大數相加!不過要注意,有小數點!輸出的格式也非常嚴格!WA了很多次,因為沒有考慮到全是0.00相加的情況! #include "iostream"#include "string"#include "memory.h"#include "cctype"#include "algorithm"using namespace std;int temp[20], ans[20];int main(){ int N, i, j, k, len, count; string

zoj 1915 Above Average

#include "iostream"#include "algorithm"#include "memory.h"#include "iomanip"using namespace std;int main(){int num[1010];int testcase, n, i, sum, average, count;double ans;cin >> testcase;while (testcase--){cin >> n;memset(num, 0, sizeof(

poj 2317 SHAKE

//矩形矩陣加密,有三種方法,要類比這三種方法 ,第一,第二種加密方法比較容易實現,第三種方法比較麻煩,有點類似於//蛇形填數的方法一樣,只要認真地類比一次,也是很容易就出來了! #include "iostream"#include "string"#include "cctype"using namespace std;char matrix[110][110];void shake(char (*a)[110], int r, int l)//第一種加密方法的實現 { int i,

zoj 1949 Error Correction

#include "iostream"#include "memory.h"using namespace std;int matrix[110][110], rowsum[110], columnsum[110], rowans[110], columnans[110];int main(){int n, i, j, rowcount, columncount;while (cin >> n && n){memset(rowsum, 0,

zoj 1078 Palindrom Numbers

#include "iostream"#include "string"#include "vector"using namespace std;int main(){int num, i;vector<int> v;while (cin >> num && num){v.clear();for (i = 2; i < 17; i++)//從2到16進位的數進行相除,求出進位的標記法{int temp = num, temp1,

poj 2039 To and Fro

#include "iostream"#include "string"#include "algorithm"using namespace std;string str[200];int main(){ int num, len, i, j, r; string input; while (cin >> num && num) { for (i = 0; i < 200; i++) str[

zoj 2104 Let the Balloon Rise

#include "iostream"#include "string"#include "vector"using namespace std;struct ballons{string color;int count;};int main(){int N, i;vector<ballons> v;vector<ballons>::iterator it;ballons temp;bool tag;while (cin >> N && N){

zoj 1622 Switch

#include "stdio.h"#include "memory.h"int light[10010];int main(){int i, evencount1, evencount2, oddcount1, oddcount2, evencount = 0, oddcount = 0, num;while (scanf("%d", &num) != EOF){evencount1 = 0;evencount2 = 0;oddcount1 = 0;oddcount2 =

poj 1573 Robot Motion

//就開始做這一題的時候(下面的代碼),竟然WA了兩次:記憶體超出! 主要是寫代碼的時候寫的複雜了 //以下是用一個數組儲存已經行走過的點和所需要的步數!這樣就簡化了不少! #include "iostream"#include "string"#include "cctype"using namespace std;char path[12][12];int havewalk[12][12];int main(){ int r, c, pos, i, j, step, forwardi,

zoj 1201 Inversion

//發覺自己很久沒有做過題了,這題思考了很久都沒有思考出來,最後只有百度一下!哎!#include "iostream"#include "string.h"using namespace std;int main(){int i, j, num;int a[55];char ch;while (cin >> num && num){cin >> ch;if (ch == 'P')//permutation情況的處理!{for (i = 1; i <

zoj 1251 Box of Bricks

#include "iostream"using namespace std;int bricks[60];int main(){ int num, i, sum, average, count, n = 0; while (cin >> num && num) { sum = average = count = 0; n++; for (i = 0; i < num; i++)

poj 2081 Recaman’s Sequence

//這樣的題很容易逾時,所以就開兩個數組,一個儲存結果,一個儲存已經出現過的結果,這樣就容易判斷了,//如果再倒過來判斷是否出現在字串出現,就逾時了! /*#include "iostream"#include "memory.h"using namespace std;int a[500005];bool flag[20000000];int main(){ int i, j, temp1, temp2; memset(a, 0, sizeof(a));

poj 2105 IP Address

#include "iostream"#include "string" #include "cmath"using namespace std;int main(){ int tc, i, j, k, ans[4], len; string input; cin >> tc; while (tc--) { memset(ans, 0, sizeof(ans)); cin >> input;

zoj 1334 Basically Speaking

#include "iostream"#include "map"#include "string"#include "cmath"#include "algorithm"#include "iomanip"using namespace std;int main(){string str, ans;int b1, b2, i, j, len1, len2, num;map<char, int> m;//下面的映射由字母轉換為數字!m['0'] = 0, m['1'] = 1, m[

zoj 1751 When Can We Meet?

#include "iostream"#include "memory.h"#include "algorithm"using namespace std;int num[100];int ans[100];int main(){int committe, quorum, M, i, j, temp1, temp2;bool tag;while (cin >> committe >> quorum && committe &&

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