人生列车

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) 编辑

2014年7月17日 #

二分法习题HDU2199

摘要: AC代码:#include#includeusing namespace std;double y;double f(double n){ return 8*pow(n,4)+7*pow(n,3)+2*pow(n,2)+3*n+6;}double find(){ double mid; ... 阅读全文

posted @ 2014-07-17 15:56 tianxia2s 阅读(217) 评论(0) 推荐(0) 编辑

二分法经典习题——HDU1969

摘要: #include #include #include using namespace std; double pie[10005];int T, N, F;double PI = acos(-1.0); bool test(double x){ int cnt = 0; for(int ... 阅读全文

posted @ 2014-07-17 14:48 tianxia2s 阅读(539) 评论(0) 推荐(0) 编辑