CF1423J.Bubble Cup hypothesis

提高+/省选-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The Bubble Cup hypothesis stood unsolved for 130130 years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao managed to reduce the hypothesis to this problem:

Given a number mm, how many polynomials PP with coefficients in set 0,1,2,3,4,5,6,7{{0,1,2,3,4,5,6,7}} have: P(2)=mP(2)=m?

Help Jerry Mao solve the long standing problem!

“泡沫杯”猜想已悬而未决长达 130130 年。任何证明该猜想的人,都将被视为我们这个时代最伟大的数学家之一!著名数学家 Jerry Mao 成功地将该猜想简化为如下问题:

给定一个数 mm,有多少个多项式 PP,其系数均取自集合 {0,1,2,3,4,5,6,7}\{0,1,2,3,4,5,6,7\},且满足 P(2)=mP(2)=m?

请帮助 Jerry Mao 解决这一久负盛名的难题!

输入格式

The first line contains a single integer tt (1≤t≤5⋅105)(1 \leq t \leq 5\cdot 10^5) - number of test cases.

On next line there are tt numbers, mim_i (1≤mi≤1018)(1 \leq m_i \leq 10^{18}) - meaning that in case ii you should solve for number mim_i.

第一行包含一个整数 tt(1≤t≤5⋅1051 \leq t \leq 5\cdot 10^5),表示测试用例的数量。

下一行包含 tt 个数 mim_i(1≤mi≤10181 \leq m_i \leq 10^{18}),表示在第 ii 个测试用例中,你需要对数字 mim_i 进行求解。

输出格式

For each test case ii, print the answer on separate lines: number of polynomials PP as described in statement such that P(2)=miP(2)=m_i, modulo 109+710^9 + 7.

对于每个测试用例 ii,请在单独一行输出答案:即满足题面所述条件且满足 P(2)=miP(2)=m_i 的多项式 PP 的个数,对 109+710^9 + 7 取模。

输入输出样例

  • 输入#1

    2
    2 4

    输出#1

    2
    4

说明/提示

In first case, for m=2m=2, polynomials that satisfy the constraint are xx and 22.

In second case, for m=4m=4, polynomials that satisfy the constraint are x2x^2, x+2x + 2, 2x2x and 44.

第一种情况,当 m=2m=2 时,满足约束条件的多项式为 xx 和 22。

第二种情况,当 m=4m=4 时,满足约束条件的多项式为 x2x^2、x+2x + 2、2x2x 和 44。

输入解题思路,AI测评打分。不知道怎么写?

首页