[POJ3735]Training little cats】的更多相关文章

题目:Training little cats 链接:http://poj.org/problem?id=3735 分析: 1)将操作用矩阵表示出来,然后快速幂优化. 2)初始矩阵:$ \left[ \begin{array}{ccccc} 1 & a_1 & a_2 & ... & a_n \end{array} \right] $ 构造一个$ (n+1)*(n+1) $ 的单位矩阵T. 得花生:将第0行中得到花生的那一列赋为1. $ \left[ \begin{arra…
题意:有n只猫,对其进行k次操作,然后反复这样操作m次. 其中g 表示 i 猫加1, e表示 i 猫为0:s表示  i 与 j 猫互换. 解释一下样例: 3 1 6g 1g 2g 2s 1 2g 3e 2 则, (g 1 第一只猫加1):1, 0, 0:=>1,1,0=>1,2,0=>(s 1 2 第一只猫和第二只猫互相交换)2,1,0=>2,1,1=>(第2只猫为0)2,0,1; 好了:我们知道初等矩阵:有交换,置0,哪一行加常数的作用. 偷一张图: 像这样!是不是就可以表…
题目链接:http://poj.org/problem?id=3735 题目意思: 调教猫咪:有n只饥渴的猫咪,现有一组羞耻连续操作,由k个操作组成,全部选自: 1. g i 给第i只猫咪一颗花生 2. e i 让第i只猫咪吃光它的花生 3. s i j 交换猫咪i与猫咪j的花生 现将上述一组连续操作做m次后,求每只猫咪有多少颗花生? 思路:这道题难点在如何把这种奇怪的操作转化为矩阵操作,网络上看到一个画的很好的图,这里直接偷过来. 现在,对于每一个操作我们都可以得到一个转置矩阵,把k个操作的矩…
Training little cats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9299   Accepted: 2230 Description Facer's pet cat just gave birth to a brood of little cats. Having considered the health of those lovely cats, Facer decides to make th…
Training little cats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 10737   Accepted: 2563 Description Facer's pet cat just gave birth to a brood of little cats. Having considered the health of those lovely cats, Facer decides to make t…
Training little cats poj-3735 题目大意:给你n个数,k个操作,将所有操作重复m次. 注释:三种操作,将第i个盒子+1,交换两个盒子中的个数,将一个盒子清空.$1\le m \le 10^9$ , $1\le n , k \le 100$. 想法:定义开始是的矩阵是n+1行,1列,除了最底下的数是1剩下全是0.然后加法操作就是讲操作答案矩阵的对应位置+1,交换操作就是暴力交换操作答案矩阵的两行,清空操作是将操作答案矩阵的对应行清零. 至于最后的将所有操作重复,将单次操…
题目传送门 /* 题意:k次操作,g:i猫+1, e:i猫eat,s:swap 矩阵快速幂:写个转置矩阵,将k次操作写在第0行,定义A = {1,0, 0, 0...}除了第一个外其他是猫的初始值 自己讲太麻烦了,网上有人讲的很清楚,膜拜之 详细解释:http://www.cppblog.com/y346491470/articles/157284.html */ #include <cstdio> #include <cstring> #include <cmath>…
Training little cats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9613   Accepted: 2296 Description Facer's pet cat just gave birth to a brood of little cats. Having considered the health of those lovely cats, Facer decides to make th…
Training little cats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 13488   Accepted: 3335 Description Facer's pet cat just gave birth to a brood of little cats. Having considered the health of those lovely cats, Facer decides to make t…
Training little cats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 11787 Accepted: 2892 Description Facer's pet cat just gave birth to a brood of little cats. Having considered the health of those lovely cats, Facer decides to make the c…