摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1047虽然说这题水,但我也没一次过。第一次没有考虑到一个输入块只包含0的情况。#include <iostream>using namespace std;const int LEN = 200;//图方便,将这些都作为全局变量char aLine[LEN];int oneInput[LEN],res[LEN];//将aLine以逆序转成oneInputvoid toInt(){ int len = strlen(aLine); memset(oneInput,0,sizeof(oneI 阅读全文
posted @ 2012-08-20 21:06 peaceful 阅读(194) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1036我也不知道这题考查什么,感觉就是考细心。1.时间要能正确的读,输出的格式要对。2.结果要四舍五入。说一下四舍五入的方法,刚从别人那里学的。假设a为要舍入的数,res为结果。1.精确到个位。int res = a + 0.5;2.精确到小数点后第k位。double a, res, base;int k;double base = pow(10.0, k * 1.0);res = ((int)(a * base + 0.5)) / base;经简单测试,有效。PS:上面的高亮显示貌似有问题啊,ba 阅读全文
posted @ 2012-08-19 22:35 peaceful 阅读(161) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1035稍微有点复杂,但是只要模拟出来应该就能过了。#include <iostream>using namespace std;class node{public: char instruct; int stepId;};const int SIZE = 12;char aLine[SIZE];node map[SIZE][SIZE];void move(int &curRow,int &curCol,char instruct){ switch (instruct) { 阅读全文
posted @ 2012-08-19 21:20 peaceful 阅读(116) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1034把题意模拟出来就可以了,不多说。#include <iostream>using namespace std;const int LEN = 10000;int input[LEN],pass[LEN];int len;int isEnd(){ int pre = input[0]; for (int i = 0;i < len;i ++) { if (input[i] != pre) return 0; pre = inpu... 阅读全文
posted @ 2012-08-18 21:53 peaceful 阅读(140) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1031排序。没有给N,M的范围,所以用了vector。不用将所有输入数据存下来,只需计算同一个编号的design的总得分。对总得分排序,题目规定得分时,再按design的编号排序。取前K个design。再对着K个design按编号由大到小排序。#include <algorithm>#include <iostream>#include <vector>using namespace std;class vote{public: int id; double sc 阅读全文
posted @ 2012-08-18 21:02 peaceful 阅读(335) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1017这种题就不说什么了。#include <iostream>using namespace std;inline int isSatisfied(int a,int b,int m){ if ((a * a + b * b + m) % (a * b) == 0) return 1; else return 0;}int main (){ freopen("input.txt","r",stdin); freopen("output. 阅读全文
posted @ 2012-08-18 20:16 peaceful 阅读(156) 评论(0) 推荐(0)
摘要: 纯粹考操作。我用到了<algorithm>中的reverse函数。#include <iostream>#include <algorithm>using namespace std;const int LEN = 1005;char a[LEN],b[LEN],sum[LEN];void Init(){ for (int i = 0;i < LEN;i ++) a[i] = b[i] = sum[i] = 0;}void getSum(){ int len = max(strlen(a),strlen(b)); int i; for (i = 0;i 阅读全文
posted @ 2012-08-17 20:17 peaceful 阅读(123) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1300参考博客链接:http://www.cnblogs.com/XBWer/archive/2012/08/13/2636836.html这题纠结了好久,最后还是看了别人的思路。以下是解题思路。1.假设共有t个级别的珍珠。解可以被描述成(1,2...i),(i+1,i+2...k)...(s,s+1...t)形式,每个括号中的珍珠按该括号中最后一个级别的珍珠的价格购买。这里要注意的是,假设按等级由低到高的顺序,有i,j,k三个级别的珍珠,答案中不可能出现i按k的价格购买,j按j自己的价格购买的情况 阅读全文
posted @ 2012-08-17 10:41 peaceful 阅读(159) 评论(0) 推荐(0)
摘要: 源地址:http://www.cnblogs.com/eoiioe/archive/2008/09/20/1294681.html.tar解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gunzip FileName.gz解压2:gzip -d FileName.gz压缩:gzip FileName.tar.gz 和 .tgz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileName.tar.gz DirName—————— 阅读全文
posted @ 2012-08-16 13:38 peaceful 阅读(230) 评论(0) 推荐(0)
摘要: 昨天把Linux下的tomcat安装了,但是一直不能从localhost:8080中进入“tomcat manager”。后来看了网上的介绍,发现修改/conf/tomcat-users.xml就可以了。需要注意的是:1.将围住role和user定义行的注释去掉。2.添加role(名字在NOTE注释给出),并添加属于该role的user。其实上面两点,在tomcat-users.xml内都有说明。我使用的这个版本,在<tomcat-users>...</tomcat-users>中就有两个NOTE注释:<!--NOTE: By default, no user i 阅读全文
posted @ 2012-08-16 09:18 peaceful 阅读(395) 评论(0) 推荐(0)