301453: CF273E. Dima and Game
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Dima and Game
题意翻译
### 游戏规则 每次操作时取 $n$ 对整数中的一对 $(l,r)$ (需要满足 $r-l>2$ ),将其变成 $(l+\frac{r-l}{3},l+\frac{r-l}{3}×2)$ 或是 $(l,r-\frac{r-l}{3})$ ,所有除法都是向下取整。 当一个玩家没法操作时就输了。 ### 目标 构造 $n$ 对整数使得先手必胜,给定一个 $p$ 使得 $l,r$ 均小于 $p$ ,求方案数除以 $10^9+7$ 的余数。题目描述
Dima and Anya love playing different games. Now Dima has imagined a new game that he wants to play with Anya. Dima writes $ n $ pairs of integers on a piece of paper $ (l_{i},r_{i}) $ $ (1<=l_{i}<r_{i}<=p) $ . Then players take turns. On his turn the player can do the following actions: 1. choose the number of the pair $ i $ $ (1<=i<=n) $ , such that $ r_{i}-l_{i}>2 $ ; 2. replace pair number $ i $ by pair ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF273E/9e084f4371b7b137e0f6781dcd5a7dd3aa3d3533.png) or by pair ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF273E/203e78a07f9b5539eaf775cc2321c9238b008110.png). Notation $ ⌊x⌋ $ means rounding down to the closest integer. The player who can't make a move loses. Of course, Dima wants Anya, who will move first, to win. That's why Dima should write out such $ n $ pairs of integers $ (l_{i},r_{i}) $ $ (1<=l_{i}<r_{i}<=p) $ , that if both players play optimally well, the first one wins. Count the number of ways in which Dima can do it. Print the remainder after dividing the answer by number $ 1000000007 (10^{9}+7) $ . Two ways are considered distinct, if the ordered sequences of the written pairs are distinct.输入输出格式
输入格式
The first line contains two integers $ n $ , $ p $ $ (1<=n<=1000,1<=p<=10^{9}) $ . The numbers are separated by a single space.
输出格式
In a single line print the remainder after dividing the answer to the problem by number $ 1000000007 (10^{9}+7) $ .
输入输出样例
输入样例 #1
2 2
输出样例 #1
0
输入样例 #2
4 4
输出样例 #2
520
输入样例 #3
100 1000
输出样例 #3
269568947