您的位置:首页 > 其它

2015 CCPC L题 【水题】

2015-10-28 19:16 309 查看
题目链接 点我

题意:有n种药串在一起,医生只记得放的顺序。现在让你找到最短的链 使得医生在黑暗中也可以找到想要的药。

思路:对称,答案 为 2*n-1。

AC代码:

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#define lson o<<1|1, l, mid
#define rson o<<1, mid+1, r
#define ll o<<1
#define rr o<<1|1
#define INF 0x3f3f3f3f
#define eps 1e-8
#define debug printf("1\n")
#define MAXN 10000
#define MAXM 100000
#define LL long long
#define FOR(l, r, d) for(int i = l; i <= r; i+=d)
#define CLE(a, b) memset(a, (b), sizeof(a))
#define W(a) while(a--)
#define Ri(a) scanf("%d", &a)
#define Pi(a) printf("%d\n", (a))
#define Rl(a) scanf("%lld", &a)
#define Pl(a) printf("%lld\n", (a))
using namespace std;
int main()
{
int t, kcase = 1;
scanf("%d", &t);
W(t)
{
LL n; Rl(n);
printf("Case #%d: ", kcase++);
Pl(2*n-1);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: