标签:
1 /*
2 数学:假设取了第i个,有C(n-1)(i-1)种取法
3 则ans = sum (C(n-1)(i-1)) (1<i<=n) 即2^(n-1)
4 */
5 #include <cstdio>
6 #include <algorithm>
7 #include <cstring>
8 #include <cmath>
9 using namespace std;
10
11 typedef long long ll;
12 const int MAXN = 1e4 + 10;
13 const int INF = 0x3f3f3f3f;
14 const int MOD = 1000000007;
15
16 int main(void) //FZU 2074 Number of methods
17 int n;
18 while (scanf ("%d", &n) == 1)
19 {
20 ll sum = 1;
21 for (int i=1; i<n; ++i)
22 {
23 sum = sum * 2 % MOD;
24 }
25 printf ("%I64d\n", sum);
26 }
27
28 return 0;
29 }
标签:
原文地址:http://www.cnblogs.com/Running-Time/p/4650197.html