摘要: 题意:问你冒泡排序第i次排序,一共排了多少次套公式K!((K + 1) ^ (N - K) - K ^ (N - K))#include #include#includeusing namespace std;#define LL long long#define N 1000010#define M 20100713LL a[N];int _pow(LL v,int k){ LL res=1; while(k){ if(k&1){ res=res*v; res%=M; } v=v*v; v%=M; k>>=1; } return res;}int main(int arg 阅读全文
posted @ 2013-11-13 22:35 Teemo的技术blog 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 题意:略直接矩阵乘法就行了#include #include#includeusing namespace std;#define LL __int64#define N 30int n,m;struct node{ int mat[N][N]; node operator *(const node &x){ node tmp; memset(tmp.mat,0,sizeof(tmp.mat)); for(int i=0;i>=1; }}int main(int argc, char** argv) { int... 阅读全文
posted @ 2013-11-13 22:29 Teemo的技术blog 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 题意:略构造出矩阵就行了 | AX 0 AXBY AXBY 0 | | 0 BX AYBX AYBX 0 |{a[i-1] b[i-1] a[i-1]*b[i-1] AoD[i-1] 1}* | 0 0 AXBX AXBX 0 | = {a[i] b[i] a[i]*b[i] AoD[i] 1} | 0 0 0 1 ... 阅读全文
posted @ 2013-11-13 22:25 Teemo的技术blog 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 题意:略简单的矩阵快速幂就行了#include #include #include using namespace std;#define LL long long #define N 10int m;struct node{ int mat[N][N]; node operator *(const node &x){ node tmp; memset(tmp.mat,0,sizeof(tmp.mat)); for(int i=0;i>=1; } return b;}int main(int argc, char** argv) { int sum,n; int i,j; whi 阅读全文
posted @ 2013-11-13 22:20 Teemo的技术blog 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 题意: 通过各种操作进行,给第i只猫花生,第i只猫吃光花生,第i只猫和第j只猫互换花生,问n次循环操作后结果是什么很明显是构建个矩阵,然后矩阵相乘就好了#include #include #includeusing namespace std; #define LL long long #define N 110LL n,m,d;struct node{ LL mat[N][N]; node operator*(const node &x){ node tmp; int i,j,k; memset(tmp.mat,0,sizeof(tmp.mat)); for(i=0;i>=1; 阅读全文
posted @ 2013-11-13 22:06 Teemo的技术blog 阅读(123) 评论(0) 推荐(0) 编辑