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;
}
题解:当有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;
}
相关文章推荐
- UESTC 1221 Ancient Go
- UICollectionViewController
- UESTC 1218 Pick The Sticks
- Coding Guidelines for Cocoa
- Optimizing string function in UE4
- UESTC 1215 Secrete Master Plan
- R语言读取txt文件中的内容
- How to add multiple filters to UIImage GPUImage?
- mysql-普通查询(General Query)慢查询(Slow Query)相关日志配置
- Error:Could not read cache value from '/Users/wangjin/.gradle/daemon/2.2.1/registry.bin'.
- MessageQueue, Looper, Thread, Handler, Message, Messenger
- 如何正确选择uiimage之间不同的过滤器(gpuimage)
- PHP数组之array_values
- UESTC 1218 Pick The Sticks
- 在PL/SQL DEV里面有把锁一样的按钮,点击它会跳出“these query result are not updateable,include the ROWID to get updateab
- 从xib加载UIViewController的一个坑
- [转]IOS 贝塞尔曲线UIBezierPath方法总结
- Using GPUImage to Recreate iOS 7 Glass Effect
- 设置UIButton的文字显示位置、字体的大小、字体的颜色
- GPUImage滤镜中的shader代码分析,及自定义滤镜