SOJ2646.Periodic points

 

2646. Periodic points
 
   
   
 
Time Limit: 5sec    Memory Limit:256MB
Description
Computing the number of fixed points and, more generally, the number of periodic orbits within a dynamical system is a question attracting interest from different fields of research. However, dynamics may turn out to be very complicated to describe, even in seemingly simple models. In this task you will be asked to compute the number of periodic points of period n of a piecewise linear map f mapping the real interval [0, m] into itself. That is to say, given a map f : [0, m] [0, m] you have to calculate the number of solutions to the equation for x [0, m], where  is the result of iterating function f a total of n times, i.e.

where o stands for the composition of maps, (h)(x) = g(h(x)).
Fortunately, the maps you will have to work with satisfy some particular properties:
  • m will be a positive integer and the image of every integer in [0, m] under f is again an integer in [0, m], that is, for every k {0, 1,..., m} we have that f (k) {0, 1,..., m}.
  • For every k {0, 1,..., m - 1}, the map f is linear in the interval [kk + 1]. This means that for every x  [kk + 1], its image satisfiesf (x) = (k + 1 - x)f (k) + (x - k)f (k + 1), which is equivalent to its graph on [kk + 1] being a straight line segment.

Figure 1: Graphs of the third map in the sample input,  (left), and of its square,.
       Since there might be many periodic points you will have to output the result modulo an integer.
Input
The input consists of several test cases, separated by single blank lines. Each test case begins with a line containing the integerm ( 1<=m<=80). The following line describes the map f; it contains the m + 1 integers f (0), f (1),..., f (m), each of them between 0 and m inclusive. The test case ends with a line containing two integers separated by a blank space, n ( 1<=n<=5 000) and the modulus used to compute the result, “mod” ( 2<=mod<=10 000).
       The input will finish with a line containing 0.
Output
For each case, your program should output the number of solutions to the equation fn(x)=x in the interval [0, m] modulo “mod”. If there are infinitely many solutions, print “Infinity” instead.

 

Sample Input
2
2 0 2
2 10

3
0 1 3 2
1 137

3
2 3 0 3
20 10000

0
Sample Output
4
Infinity
9074
题意:
给一个分段函数f(n), 保证相邻两个整点之间是直线,整点上的数为整数,求fn(x)和g(x)=x的交点数。
大致思路:
如果f在某个单位区间上的值包含区间y,而且如果f做n次幂后这一段出现在y区间上,那么就肯定有且仅有一个交点。那么将每个单位区
间映射成一个点,然后对f在这个区间上的值域所包含的区间都连一条有向边,例如f(0) = 0, f(1) = 2, 那么连一条1指向1和1指向2的边。
然后f做n次幂后在第x区间包含第y区间线段的条数就等价与x到y刚好走过n条路的方案数,这个用g[x][y][t]表示x到y刚好走t段路的方案数
递推一下就可以出来(反向来做能做到O(1)的转移),最后做一下判断:每个区间在哪些区间会与g(x)=x相交,最后求总和即可。
P.S.
a。整点上的数要处理好,会有多算的和漏掉的。
b。无穷的判别:
      1)fn(t) = t, fn(t + 1) = t + 1
      2 ) 若1<=m<=n, | fm(t) - fm(t+1) | = 1
满足这个两条式子就肯定有无穷个交点。
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值