人生列车

follow on!success!

导航

2014年7月18日 #

矩阵快速幂——将运算推广到矩阵上HDU 1575

摘要: /*本题的思路比较简单,就是将递推公式写出来,然后表达成为一个矩阵的形式最后通过计算就可以得到一个符合题目要求的矩阵,然后就是将矩阵上面所有的对角线元素相加得到的结果即为所求的目标*/#include #include using namespace std; const int maxn = 15... 阅读全文

posted @ 2014-07-18 14:26 tianxia2s 阅读(156) 评论(0) 推荐(0) 编辑

矩阵快速幂AC代码HDU 2035

摘要: #include using namespace std;const int MOD = 1000;//像这样的一个常量就应该专门定义一下int PowMod(int a, int n)//a^n%MOD { int ret = 1; while(n) { ... 阅读全文

posted @ 2014-07-18 10:52 tianxia2s 阅读(163) 评论(0) 推荐(0) 编辑

二分法习题讲解

摘要: #include using namespace std;int num[]={3,5,7,9,10,12,15,20,25,30};//10个数int main(){ int x; while(cin>>x) { int L,R,mid; L=0;R=... 阅读全文

posted @ 2014-07-18 09:12 tianxia2s 阅读(296) 评论(0) 推荐(0) 编辑