摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3117只会求后四位的,前四位也是看别人的博客学的。。。。http://blog.csdn.net/xieqinghuang/article/details/7789908View Code 1 #include 2 #include 3 const int m=10000; 4 const double t=(1+sqrt(5.0))/2; 5 using namespace std; 6 int n; 7 int f[40]={0,1,1,2,3,5,8,13,21,34,55}; 8 9 s.. 阅读全文
posted @ 2013-03-01 21:29 ihge2k 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2256感觉矩阵好神奇啊。。。盗张图,看了就知道怎么做了。。。好吧,直接上代码了,问题转化是难点View Code 1 #include 2 const int m=1024; 3 using namespace std; 4 int n; 5 struct Matrix{ 6 int map[2][2]; 7 }; 8 Matrix mat; 9 10 void Initiate(){11 mat.map[0][0]=5;12 mat.map[0][1]=12;13 ... 阅读全文
posted @ 2013-03-01 19:09 ihge2k 阅读(668) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1588比hdu 1757难了好多,看了好多别人的博客才明白。。。哎。。。View Code 1 /* 2 *题意:g(i)=k*i+b,sum(f(g(i)) for 020 using namespace std;21 22 int k,b,n,m;23 struct Matrix {24 __int64 map[2][2];25 };26 Matrix matrix,matk,matb,smat;27 28 //矩阵乘法29 Matrix Mul(Matrix &a,Matrix &am 阅读全文
posted @ 2013-03-01 17:16 ihge2k 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1757盗用一张图:把问题转化为求矩阵的n-9次幂就行了;直接上代码了;View Code 1 #include 2 #include 3 const int N=10; 4 using namespace std; 5 int k,m; 6 struct Matrix{ 7 int map[N][N]; 8 }; 9 10 Matrix matrix;11 12 void Initiate(){13 for(int i=0;i>1);46 return Mul(te... 阅读全文
posted @ 2013-03-01 11:10 ihge2k 阅读(1106) 评论(1) 推荐(1) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1753wa了N次,惭愧啊View Code 1 #include<iostream> 2 #include<string> 3 #include<cstring> 4 const int N=1000; 5 using namespace std; 6 int num[N]; 7 8 int main(){ 9 string str1,str2; 10 while(cin>>str1>>str2){ 11 string s1[2],s2[2 阅读全文
posted @ 2013-03-01 09:17 ihge2k 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1316意思很简单,就是让你计算在两个数之间有多少个斐波那契数,很挫的时我一开始把string的比较给搞错了,一直出不来结果。。。orz,还是直接上代码了。。View Code 1 #include<iostream> 2 #include<string> 3 #include<cstring> 4 const int N=1000; 5 using namespace std; 6 string f[N]; 7 int num[N]; 8 9 void solve 阅读全文
posted @ 2013-02-28 16:04 ihge2k 阅读(240) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1274一开始solve没有返回位置,然后递归的时候就出错了。。。STL特别好用。。。View Code 1 #include<iostream> 2 #include<string> 3 using namespace std; 4 5 int solve(string &str,string &restr,int pos){ 6 int len=str.length(); 7 while(pos<len){ 8 //是字母 9 if(str[p... 阅读全文
posted @ 2013-02-26 17:05 ihge2k 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1239一道水题,素数筛选即可View Code 1 #include<iostream> 2 #include<cmath> 3 const int N=11000; 4 using namespace std; 5 bool mark[N]; 6 int prime[N]; 7 8 //素数筛选 9 void sieve_prime(){10 memset(mark,true,sizeof(mark));11 mark[0]=mark[1]=false;12 for(i.. 阅读全文
posted @ 2013-02-26 14:58 ihge2k 阅读(346) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1238最主要的是要求字符串的子串,反串,直接用string;View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<string> 4 using namespace std; 5 int n; 6 string s[111]; 7 8 int cmp(const string p,const string q){ 9 return p.length()<q.length();10 }1 阅读全文
posted @ 2013-02-26 11:51 ihge2k 阅读(271) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2013-02-04 21:31 ihge2k 阅读(3) 评论(0) 推荐(0) 编辑