上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 182 下一页
摘要: 简单模拟View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <algorithm>using namespace std;#define max_key_len 15#define max_len 105struct Elem{ char ch; int index;}letter[max_key_len];char key[max_key_len];int key_len;char st[max_len] 阅读全文
posted @ 2012-12-20 11:30 undefined2024 阅读(150) 评论(0) 推荐(0)
摘要: 模拟View Code //zoj1068#include <iostream>#include <string>using namespace std;const int maxn=102;int N,number[maxn],transnum[26]={2,4,4,3,1,4,3,4,2,4,3,4,2,2,3,4,4,3,3,1,3,4,3,4,4,4};string st,code,translate[26]={".-","-...","-.-.","-..",".&quo 阅读全文
posted @ 2012-12-19 11:10 undefined2024 阅读(405) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <string>#include <cmath>using namespace std;const int maxn = 10001;string dictionary[maxn], checking;int total;bool common(string a, string b){ int i, different; string t; bool first; if (abs(int(a.length() - b.len... 阅读全文
posted @ 2012-12-18 20:27 undefined2024 阅读(224) 评论(0) 推荐(0)
摘要: 题意:给出一个数n,将其拆分为若干个互不相等的数字的和,要求这些数字的乘积最大。分析:我们可以发现任何一个数字,只要能拆分成两个大于1的数字之和,那么这两个数字的乘积一定大于等于原数。也就是说,对于连乘式中,如果将一个乘数a更换为两个数字b×c(a=b+c且b>1,c>1),那么乘积只可能增大或不变,不会减小。所以我们拆分的原则就是将这些数字拆得尽量小,拆成许多2的乘积是最好的。又因为题目约束各个数字不能相同,则我们拆分的结果最理想的情况是从2开始的公差为1的等差数列。但是有时是无法构成这样的等差数列的,因为构成到某一位时会出现构建下一位不够用的情况,例如,n=6时,6= 阅读全文
posted @ 2012-12-17 11:25 undefined2024 阅读(1589) 评论(0) 推荐(1)
摘要: 简单栈模拟View Code #include <iostream>#include <stack>#include <string>using namespace std;stack<string>bstack, fstack;string current;void visit(){ if (current != "") bstack.push(current); cin >> current; while (!fstack.empty()) fstack.pop(); cout << current 阅读全文
posted @ 2012-12-16 16:52 undefined2024 阅读(368) 评论(0) 推荐(0)
上一页 1 ··· 40 41 42 43 44 45 46 47 48 ··· 182 下一页