HDU 4602
来源:互联网 发布:红辣椒乐队 知乎 编辑:程序博客网 时间:2024/06/04 00:51
EASY PROBLEM
#include <cstdio>#include <iostream>#include <cstring>using namespace std;typedef long long LL;const int maxn = 111111;const int mod = (int) (1e9 + 7);char s[maxn];int num[maxn];LL POW(LL a, LL b) { LL ans = 1, t = a; while (b) { if (b & 1) ans = ans * t % mod; t = t * t % mod; b >>= 1; } return ans;}LL solve(LL n, LL k) { if (k > n) return 0; if (k == n) return 1; if (k == n - 1) return 2; LL a = POW(2, n - k - 2), b = POW(2, n - k); LL ans = a * (n - k - 1) + b; ans = (ans % mod + mod) % mod; return ans;}int main() { ios::sync_with_stdio(false); int T; cin >> T; while (T--) { LL n, k; cin >> n >> k; cout << solve(n, k) << endl; } return 0;}
- HDU-4602
- HDU 4602
- HDU 4602
- HDU 4602
- HDU 4602
- hdu - 4602 《Partition》
- HDU 4602 Partition
- HDU 4602 Partition
- hdu 4602 找规律
- hdu-4602-Partition
- hdu 4602 Partition
- hdu 4602题解
- HDU 4602 Partition
- hdu 4602 Partition
- hdu(4602) Partition
- hdu 4602 Partition
- HDU 4602 Partition
- hdu 4602 Partition
- 基于SUSE Linux做NFS文件挂载
- 怎样获得Win7禁止或启动的休眠的权限
- poj3068 "Shortest" pair of paths 费用流
- HDU 4606
- poj3692 Kindergarten 二分图最大独立集
- HDU 4602
- Qt项目中遇到的一些 小问题汇总
- android解压缩GZIP格式的网页数据
- HDU 4607
- HDU 4608
- HDU 4609
- poj3411 Paid Roads 状压+最短路
- HDU 4610
- JavaBean基于Builder,通用JSON解析,代码生成器