Teams(uva11609+组合)

it2025-07-09  14

I - Teams Time Limit:1000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit  Status  Practice  UVA 11609

 

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

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

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

题目链接:UVA 11609 

 

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

cid=77956#overview

 

 

#include<stdio.h> #define mod 1000000007 #define LL long long LL ppow(LL x,LL n) { LL tp=1; while(n) { if(n&1) tp=tp*x%mod; n>>=1; x=x*x%mod; } return tp; } int main() { int ca=1,T; scanf("%d",&T); LL n; while(ca<=T) { scanf("%lld",&n); printf("Case #%d: %lld\n",ca++,(n*ppow(2,n-1))%mod); } return 0; }

 

 

版权声明:本文博主原创文章,博客,未经同意不得转载。

转载于:https://www.cnblogs.com/bhlsheji/p/4889270.html

相关资源:数据结构—成绩单生成器
最新回复(0)