您的位置:首页 > 产品设计 > UI/UE

UESTC 1226 Huatuo's Medicine

2015-10-30 12:12 525 查看
题意:有n个药需要放在m个瓶子中,且瓶子要连成一链,且链的头和尾无法区分出,求最小的m

题解:当有5种药时 按照A-B-C-D-E-D-C-B-A这样构造即可 所以答案2*n-1

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cctype>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#define scnaf scanf
#define cahr char
#define bug puts("=========================");
using namespace std;
typedef long long ll;
const int mod=1000000007;
const int maxn=5000+5;
const int inf=1e9;
int main()
{
int T_T,test=1;
scanf("%d",&T_T);
while(T_T--)
{
int n;
scanf("%d",&n);
printf("Case #%d: %d\n",test++,2*n-1);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: