hdu 3807
很好的思路 枚举有多少人有ipad 判是否满足题目给出的条件
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#define INF 0x7f7f7f7f
using namespace std; int num[1010];
vector<int> ans;
int main()
{
int t, n, x, A, B;
scanf("%d", &t);
while(t--)
{
memset(num, 0, sizeof(num));
ans.clear();
scanf("%d", &n);
for(int i = 0; i < n; ++ i)
{
scanf("%d",&x);
num[x]++;
}
scanf("%d%d", &A, &B);
for(int i = 1; i <= n; ++ i)
{
for(int j = 0; j <= A; ++ j)
{
int lie = n-num[i];
if(i-j >= 0 && lie-j >= 0 && (n-(i-j+lie) >= 0 && n-(i-j+lie) <= B))
{
ans.push_back(i);
break;
}
}
}
if((int)ans.size() == 0)
printf("impossible\n");
else
{
int len = ans.size();
for(int i = 0; i < len-1; ++ i)
printf("%d ", ans[i]);
printf("%d\n", ans[len-1]);
}
}
return 0;
}
hdu 3807的更多相关文章
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
- hdu 4329
problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟 a. p(r)= R'/i rel(r)=(1||0) R ...
随机推荐
- JAVA(int...i)问题
第一次看到这种写法,弄不明白到底会是神马结果,运行后才发现是这么的神奇. 无论你调用的方法中带几位参数,“hello”一直可以被输出.
- Requirejs学习笔记(一)
中文api 和 英文api网上都有的我就不翻译了,我的学习方法是先看英文api,然后看不懂的就比对中文api看一遍. requirejs可以帮助js代码模块化开发,模块化意味了解决了代码凌乱的问题,方 ...
- 杭电ACM2080--夹角有多大II
http://acm.hdu.edu.cn/showproblem.php?pid=2080 /* //Author:nunu // #include <stdio.h> #include ...
- The Name/Origin of Country names
1.Puerto Rico (Spanish for "Rich Port"/富裕的港口/富港 ) 2.HongKong(Chinese for "香港")
- Powerdesigner15 创建数据库生成脚本
Ctrl + Shift + X,打开脚本编辑界面,使用VBScript编写脚本 点击帮助按钮,可以打开OLE Help,“Libraries >> PdPDM”中可以查看内置的类库.“A ...
- C#中Split函数的使用
Split函数 描述 :返回一个下标从零开始的一维数组,它包含指定数目的子字符串. 语法 :Split(expression[, delimiter[, count[, compare]] ...
- jquery文字上下滚动的实现方法
jquery实现文字上下滚动的方法. 代码: //上下滚动var textRoll=function(){$('#notice p:last').css({'height':'0px','opacit ...
- iOS实现图片的缩放和居中显示
直接上代码 // // MoveScaleImageController.h // MoveScaleImage // // Created by on 12-4-24. // Copyright ( ...
- .NET SDK和下载
http://blogs.msdn.com/b/dotnet/p/dotnet_sdks.aspx .NET SDK和下载 您可以通过下载.NET框架针对包和软件开发工具包,并使用它们与Visual ...
- python杂记-5(装饰器)
1.被装饰的函数有参数(一个参数): def w1(func): def inner(arg): # 验证1 # 验证2 # 验证3 return func(arg) return inner @w1 ...