随笔分类 -  acm

摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3504C代表有几个字母,每一行输入的16进制是每个字母的显示,每个字母有7行5列,每一行输入的5个16进制数,每个二进制数对应显示的每一列,取每个16进制数的二进制表示的后7位,如果该位为1,则显示'#',否则显示为空格。比如第一个case的第一列7F 08 08 08 7F是字母H的显示,H有7行5列,7F的二进制表示为01111111,后面7位为1,则相应的字母显示的第一列显示为'#######'。注意,每行有6C*1个字符,是字母之间要用 阅读全文
posted @ 2009-12-05 19:27 zhwj184 阅读(147) 评论(0) 推荐(0)
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3220简单题,好久没写c++代码了,练习zoj,也学习c++.#include <iostream>#include <cmath>using namespace std;const int ROW = 8;const int COLUMN = 6;char abacus[ROW][COLUMN];int main(){ int cas; cin >> cas; int start; int end; int sum; while(cas- 阅读全文
posted @ 2009-12-05 18:29 zhwj184 阅读(106) 评论(0) 推荐(0)
摘要:#include <iostream>#include <cmath>using namespace std;const int SIZE = 100;int map[SIZE][SIZE];struct{ int min; int max; char direction;}step[SIZE];int n;int m;int stepSize ;int isOk;void swap(int &a, int &b){ int t = b; b = a; a = t;}bool canGo(int sx, int sy, int ex, int ey){ 阅读全文
posted @ 2009-12-05 14:43 zhwj184 阅读(117) 评论(0) 推荐(0)
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3322最小区间覆盖,排序加上贪心。#include <iostream> #include <algorithm> #include <cstdio>using namespace std;struct SetNode{ int a; int b;}mySet[5010];int n;int minPoint;int maxPoint;bool cmp(SetNode a, SetNode b){ if(a.a != b.a) return 阅读全文
posted @ 2009-09-06 00:14 zhwj184 阅读(129) 评论(0) 推荐(0)
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3321回溯,dfs实现,注意要用long long, 9个100相乘最大数需要long long表示。#include <iostream>#include <cstdio>using namespace std;long long a[20];int n;int k;long long ans;const long long inf = 1000000000000000LL;long long myabs(long long nn){ return 阅读全文
posted @ 2009-09-05 23:31 zhwj184 阅读(109) 评论(0) 推荐(0)
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1875#include <vector>#include <iostream>#include<algorithm>#include <string>#include <cstring>using namespace std;int main(){ vector<string> phonelist; int testcast; cin >> testcast; while(testcast-- 阅读全文
posted @ 2009-09-05 16:28 zhwj184 阅读(152) 评论(0) 推荐(0)
摘要:对于每一行 ,都要从某一位置分成两段 ,由于不能切出0长度的一段,所 以有n - 1个选择 ,一共m行 ,就是(n - 1)m种方案 。由于问题的规模很 小 ,暴力枚举所有情况取最优解就可以了。直接用dfs即可。#include <iostream>#include <cstdlib>#include <string>#include <cctype>using namespace std;const int MAXSIZE = 8;long nutrition[MAXSIZE][MAXSIZE];int m, n;long mindiff = 阅读全文
posted @ 2009-09-03 22:16 zhwj184 阅读(139) 评论(0) 推荐(0)
摘要:#include <iostream>#include <string>#include <stack>#include <fstream>using namespace std;char *pSrc = NULL;char *pDest = NULL;stack<char> s1;char res[1000];int cnt = 0;void work(){ if(*pDest == '/0'){ for(int i = 0; i < cnt; i++){ cout << res[i] <&l 阅读全文
posted @ 2009-09-01 23:06 zhwj184 阅读(146) 评论(0) 推荐(0)