F-Sumo and Luxury Car
As we all know, Sumo has a lot of luxury cars, Maserati, Porsche, Lincoln, and so on. Countless cars are parked in his garage. He is worried about what kind of car he drives every day. Can you help him?
Sumo has a total of n cars. Every day, he will choose any number of cars from the n cars (the number of cars cannot be 0) to form a team, and then choose one from this team to drive himself. How many options are there?
If the selected team set is different or the car he chooses is different, it is considered to be two different plans.
输入描述:
The first line of the input is a single integer T(1 \leq T \leq 10)T(1≤T≤10)which is the number of test cases. T test cases follow.
Each test case has a single integer n(1 \leq n \leq 10^9)n(1≤n≤10
9
), representing the total number of luxury cars in Sumo.
输出描述:
For each test case, print a single line containing an integer modulo 10^9+710
9
+7.
示例1
输入
复制
2
1
2
输出
复制
1
4
备注:
In the second sample, Sumo has four situations to drive:
Choose cars with numbers 1 and 2, drive the car with number 1,
Choose cars with numbers 1 and 2, drive the car with number 2,
Choose the car with numbers 1, drive the car with number 1,
Choose the car with numbers 2, drive the car with number 2.
So the answer is 4.
这个一开始以为是排列组合的问题,结果。。。。。。
不多说了,反正就是没做出来-_-
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int mod=1e9+7;
ll qpow(ll x,ll n)
{
ll sum=1;
while(n)
{
if(n%2==1)//if(n&1)
sum=(sum*x)%mod;
x=(x*x)%mod;
n>>=1;//n=n/2;
}
return sum;
}
int main()
{
long long int t,n;
cin>>t;
while(t--)
{
cin>>n;
cout<<qpow(2,n-1)*n%mod<<endl;
}
}