
ACM简单题
文章平均质量分 71
kelvingu616
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ZJU 1016 Parencodings
ZOJ Problem Set - 1016 Parencodings Time Limit:1 Second Memory Limit: 32768KB Let S = s1 s2 ... s2n be a well-formed string of parentheses. S can beencoded in two different ways:原创 2010-10-15 18:26:00 · 653 阅读 · 0 评论 -
POJ 2632
#include #include typedef struct { int nX; int nY; char cDir; }Robot_S; int main() { int K; Robot_S astRobots[100 + 1]; int anMap[100 + 1][100 + 1];原创 2013-04-01 00:46:26 · 998 阅读 · 0 评论 -
ZOJ 1205 Martian Addition
简单的大数加法 #include #include #include #include using namespace std; int convertCharToInt(char c) { if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'a' && c原创 2012-11-10 08:23:36 · 428 阅读 · 0 评论 -
ZOJ分类
ZOJ分类 初学者题: 1001 1037 1045 1048 1049 1051 1067 1089 1109 1110 1115 1151 1195 1201 1205 1216 1240 1241 1242 1251 1292 1295 1331 1334 1337 1338 1350 1365 1382 1383 1394 1402 1405 1414 1494 1514 1622转载 2012-10-28 17:50:55 · 1028 阅读 · 0 评论 -
ZOJ 1208 roll the die
这题目的难点在于怎么由top和front判定原始die的各面的点数。 解决的方法还是要预设好所有情况,然后去匹配。 #include #include using namespace std; int DetermineRight(int top, int front) { // table recording the possible states of a die原创 2011-03-13 17:38:00 · 733 阅读 · 0 评论 -
ZOJ 1072 Microprocessor Simulation
也是条简单题,不过题目让我们模拟CPU挺有意思。 出现过的问题:要注意地址都是十六进制表示的,即命令(010),表示的地址(10)是十六进制,也就是指十进制的16。刚开始就是这个地方搞错了,看不懂意思。。。。 #include "iostream" using namespace std; int nMemory[256]; int A, B; int E原创 2011-03-13 17:39:00 · 641 阅读 · 0 评论 -
ZOJ 1710 The Snail
这是条简单题,调试中遇到的问题是变量应该用float或double,因为fatigue下降的距离会是小数。 代码: #include using namespace std; int main(int argc, char *argv[]) { double fHeightOfWell, fUpDistance, fDownDistance, fFatigueFactor;原创 2011-03-14 00:21:00 · 623 阅读 · 0 评论 -
ZOJ 1037 Gridland
开始没细想,就直接暴搜,当然就TLE了。后来还想是DP,但会MLE。 没办法看了别人的解法,原来是找规律题。。囧了 规律就是:m行n列,如果m或者n是偶数(或同时都是偶数),则一定有m*n个1的解法。否则,m和n都是奇数,则最短解法为(m*n-1)个1加1.41 #include int main() { int nCase = 0; scanf("%d", &原创 2012-10-28 10:27:19 · 427 阅读 · 0 评论 -
ZOJ 1201 Inversion
简单的数学题,还是挺好玩的 #include int main() { int N; while (scanf("%d", &N), N > 0) { getchar(); char type = getchar(); int num[50]; for (int i原创 2012-11-01 08:36:46 · 493 阅读 · 0 评论 -
ZOJ 1073 Round and Round We Go
典型的字符串处理题 #include #include #include #include using namespace std; int product(char num1[], int num2, char result[]) { string number(num1); int n = strlen(num1); reverse(number原创 2012-10-31 00:28:48 · 488 阅读 · 0 评论 -
ZOJ 1110 Dick and Jane
最近回溯写多了,这题其实可以两层循环枚举搞定的,但不自觉的就写成递归式了。。 #include int s, p, y, j; bool dfs(int off[], int index) { if (index == 3) { int ss = s + off[0]; int pp = p + off[1]; int原创 2012-10-31 00:22:07 · 923 阅读 · 0 评论 -
ZOJ 1151 Word Reversal
典型的字符串处理。。 #include #include using namespace std; int main() { int N; cin >> N; cin.get(); for (int i = 0; i < N; i++) { string tempStr; getline(cin,原创 2012-10-31 09:34:01 · 581 阅读 · 0 评论 -
ZOJ 1115 Digital Roots
典型大数加法题 #include #include #include #include using namespace std; int main() { string num; while (cin >> num, num[0] != '0') { while (num.length() > 1) {原创 2012-10-31 08:26:07 · 592 阅读 · 0 评论 -
ZOJ 1109 Language of FatMouse
这题靠STL的map可以轻松解决。只要注意用字符串作为map的键时不能是char *,因为在调用比如find比较键值时,就是对两个char *指针值的比较,而不是想要的字符串值的比较了。 #include #include #include #include #include using namespace std; int main() { map diction原创 2012-10-31 00:26:30 · 639 阅读 · 0 评论 -
POJ 1068
#include int main() { int t = 0; scanf("%d", &t); while (t--) { int n = 0; scanf("%d", &n); int nLast = 0; char aParens[40]; i原创 2013-12-06 12:47:23 · 640 阅读 · 0 评论