摘要:
简单题View Code //zoj1713#include <iostream>#include <string>using namespace std;string st;bool syll(char a){ if (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u' || a == 'y') return true; return false;}bool judge(string a, int num){ i 阅读全文
posted @ 2013-03-26 19:58
undefined2024
阅读(167)
评论(0)
推荐(0)
摘要:
简单题View Code //zoj1712#include <iostream>#include <string>using namespace std;string st;void work(){ int i, l = st.length(), temp = 1, ans = 0; for (i = l - 1; i >= 0; i--) { temp *= 2; ans += (st[i] - '0') * (temp - 1); } cout << ans << endl;}int main(){ //... 阅读全文
posted @ 2013-03-26 19:55
undefined2024
阅读(234)
评论(0)
推荐(0)
摘要:
dfs,x的范围似乎不是100而是1000View Code //zoj1711#include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;const int maxnum = 1001, maxn = 12;int t, n, sum[maxnum], number[maxn][2], answer[maxn], total;bool found;void init(){ int i, x; memset(sum, 0, 阅读全文
posted @ 2013-03-26 19:50
undefined2024
阅读(439)
评论(0)
推荐(0)
摘要:
简单题View Code //zoj1710//当蜗牛每天白天爬升的距离因疲劳值过多而减为负数时,认为爬升距离为0,不认为下降。#include <iostream>#include <cmath>using namespace std;int h, u, d, f,time1;double now, speed;void work(){ while (1) { now += speed; if (now > h) { cout << "success on day " << time1 << en... 阅读全文
posted @ 2013-03-26 19:40
undefined2024
阅读(137)
评论(0)
推荐(0)
摘要:
简单题bfsView Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <queue>using namespace std;#define maxn 105struct Point{ int x, y; Point() {} Point(int xx, int yy):x(xx), y(yy) {}};int n, m;bool grid[maxn][maxn];bool vis[maxn][maxn];int 阅读全文
posted @ 2013-03-26 19:38
undefined2024
阅读(274)
评论(0)
推荐(0)
摘要:
简单题View Code #include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <queue>using namespace std;#define maxn 105struct Point{ int x, y; Point() {} Point(int xx, int yy):x(xx), y(yy) {}};int n, m;bool grid[maxn][maxn];bool vis[maxn][maxn];int dir 阅读全文
posted @ 2013-03-26 19:34
undefined2024
阅读(188)
评论(0)
推荐(0)
摘要:
简单题View Code //zoj1708#include <iostream>using namespace std;const int maxn = 11;char order[maxn][maxn];int steps[maxn][maxn], n, m, start;void init(){ int i, j; memset(steps, 0, sizeof(steps)); for (i = 0; i < n; i++) for (j = 0; j < m; j++) ... 阅读全文
posted @ 2013-03-26 19:05
undefined2024
阅读(378)
评论(0)
推荐(0)
摘要:
简单题View Code //zoj1707#include <iostream>#include <string>using namespace std;const int maxn = 100;int n;string origin[maxn], replace1[maxn], sequence;void init(){ int i; for (i = 0; i < n; i++) { getline(cin, origin[i]); getline(cin, replace1[i]); ... 阅读全文
posted @ 2013-03-26 19:02
undefined2024
阅读(169)
评论(0)
推荐(0)
摘要:
并查集的经典题目,有人说也可以用floyd。并操作时要记录子节点与父节点的兑换比例。View Code //zoj1705//并查集,但是需要加入每个元素与祖先的价格比。 #include <iostream>#include <string>using namespace std;const int maxn = 200;string namelist[maxn];int listnum = 0, father[maxn][3];int toint(string st){ int i, l = st.length(), x = 0;... 阅读全文
posted @ 2013-03-26 15:58
undefined2024
阅读(154)
评论(0)
推荐(0)
摘要:
字符串处理麻烦题View Code //zoj1702#include <iostream>#include <string>using namespace std;const int maxlength = 2001, maxl = 100, maxc = 30;string header, nextheader, word[maxl][maxc];int lnum, cnum, csize[maxc];void init(){ string st; int l = 0, c = 0, i; memset(csiz... 阅读全文
posted @ 2013-03-26 15:48
undefined2024
阅读(247)
评论(0)
推荐(0)
摘要:
排序二叉树View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 105struct Node{ Node *left, *right; char letter;}tree[maxn];char st[maxn];int node_cnt;void insert(Node * &proot, char ch){ if (proot == NULL) { proot = 阅读全文
posted @ 2013-03-26 15:46
undefined2024
阅读(462)
评论(0)
推荐(0)
摘要:
dfs+排序View Code //zoj1684//注意字典序排序,是按照逐个单词比较出来的,每个句子的第x个单词只和其他句子的第x个单词进行比较。先比第一个单词再比第二个单词//例如: 句子"i am"的字典序就在句子"ia m"的前面//还有根据g++编译器,string是不能进行memset的,否则会出错。#include <iostream>#include <string>using namespace std;const int maxn = 105, maxl = 105, maxa = 105;struct wo 阅读全文
posted @ 2013-03-26 15:19
undefined2024
阅读(244)
评论(0)
推荐(0)
摘要:
dpView Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 105#define inf 0x3f3f3f3fint n;int f[maxn];int g[maxn][maxn];int main(){ //freopen("t.txt", "r", stdin); scanf("%d", &n); for 阅读全文
posted @ 2013-03-26 14:24
undefined2024
阅读(348)
评论(0)
推荐(0)
摘要:
dp注意要多dp出一段,因为有时候付钱需要超过100元再找钱。求和函数accumulate需要包含头文件numeric,使用方法为sum = accumulate(f, f + n, 0);求最大值函数max_element返回最大值指针,需要包含头文件algorithm,使用方法为max_value=*max_element(f, f+n);View Code #include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <algorith 阅读全文
posted @ 2013-03-26 13:49
undefined2024
阅读(218)
评论(0)
推荐(0)

浙公网安备 33010602011771号