CF1423J.Bubble Cup hypothesis
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The Bubble Cup hypothesis stood unsolved for 130 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 m, how many polynomials P with coefficients in set 0,1,2,3,4,5,6,7 have: P(2)=m?
Help Jerry Mao solve the long standing problem!
“泡沫杯”猜想已悬而未决长达 130 年。任何证明该猜想的人,都将被视为我们这个时代最伟大的数学家之一!著名数学家 Jerry Mao 成功地将该猜想简化为如下问题:
给定一个数 m,有多少个多项式 P,其系数均取自集合 {0,1,2,3,4,5,6,7},且满足 P(2)=m?
请帮助 Jerry Mao 解决这一久负盛名的难题!
输入格式
The first line contains a single integer t (1≤t≤5⋅105) - number of test cases.
On next line there are t numbers, mi (1≤mi≤1018) - meaning that in case i you should solve for number mi.
第一行包含一个整数 t(1≤t≤5⋅105),表示测试用例的数量。
下一行包含 t 个数 mi(1≤mi≤1018),表示在第 i 个测试用例中,你需要对数字 mi 进行求解。
输出格式
For each test case i, print the answer on separate lines: number of polynomials P as described in statement such that P(2)=mi, modulo 109+7.
对于每个测试用例 i,请在单独一行输出答案:即满足题面所述条件且满足 P(2)=mi 的多项式 P 的个数,对 109+7 取模。
输入输出样例
输入#1
2 2 4
输出#1
2 4
说明/提示
In first case, for m=2, polynomials that satisfy the constraint are x and 2.
In second case, for m=4, polynomials that satisfy the constraint are x2, x+2, 2x and 4.
第一种情况,当 m=2 时,满足约束条件的多项式为 x 和 2。
第二种情况,当 m=4 时,满足约束条件的多项式为 x2、x+2、2x 和 4。
输入解题思路,AI测评打分。不知道怎么写?