Teams(uva11609+组合)

I - Teams

                    Time Limit:1000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

题意:有n个人,选多个人参加比赛,其中一个是队长,队长不同其他选手相同也算作不同的方案,。问你一共有多少种方案。

思路:自己才纸上稍微推理一下,n*2n-1%mod;

转载请注明出处:寻找&星空の孩子 

题目链接:UVA 11609 

 

也欢迎来我开的专题刷题。哈哈http://acm.hust.edu.cn/vjudge/contest/view.action?cid=77956#overview

 1 #include<stdio.h>
 2 #define mod 1000000007
 3 #define LL long long
 4 LL ppow(LL x,LL n)
 5 {
 6     LL tp=1;
 7     while(n)
 8     {
 9         if(n&1) tp=tp*x%mod;
10         n>>=1;
11         x=x*x%mod;
12     }
13     return tp;
14 }
15 int main()
16 {
17     int ca=1,T;
18     scanf("%d",&T);
19     LL n;
20     while(ca<=T)
21     {
22         scanf("%lld",&n);
23         printf("Case #%d: %lld
",ca++,(n*ppow(2,n-1))%mod);
24     }
25     return 0;
26 }
原文地址:https://www.cnblogs.com/yuyixingkong/p/4570041.html