链接http://acm.hdu.edu.cn/showproblem.php?pid=5804

题意:给你一些商店和他的商品价格,然后给你一个记账本,问你记大了就是1,否则是0

解法:模拟,注意测试数据大小

#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define INF 0x3f3f3f3f
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define ULL unsigned long long
using namespace std;
int n,m;
long long a[1000005];
long long q,p;
long long b[1000005],e[1000005],c[1000005];
long long sum=0;
int t;
long long MAXN1,MAXN2;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
sum=0;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
// cin>>a[i];
scanf("%lld",&a[i]);
sum+=a[i];
}
for(int i=1;i<=m;i++)
{
scanf("%lld",&b[i]);
if(sum>=b[i])
{
printf("0");
}
else
{
printf("1");
}
}
puts("");
} return 0;
}

  

BestCoder Round #86 1001的更多相关文章

  1. 贪心 BestCoder Round #39 1001 Delete

    题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...

  2. 暴力 BestCoder Round #41 1001 ZCC loves straight flush

    题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...

  3. 暴力 BestCoder Round #46 1001 YJC tricks time

    题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...

  4. 字符串处理 BestCoder Round #43 1001 pog loves szh I

    题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...

  5. [HDU5807] [BestCoder Round #86 1004] Keep In Touch (DP)

    [HDU5807] [BestCoder Round #86 1004] Keep In Touch (DP) 题面 有三个人从一张N个点无重边的有向无环图上的三个点出发,每单位时间,他们分别选择当前 ...

  6. BestCoder Round #75 1001 - King's Cake

    Problem Description It is the king's birthday before the military parade . The ministers prepared a ...

  7. BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器

    题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...

  8. [BC]BestCoder Round#86小结

    1001 [题意] 给定一个长度为n(n<=100000)的正整数序列,给出m(m<=100000)个子集合和的记录,问哪些一定比正确的记录多了 [题解] 对正整数序列求和,记录比和大的一 ...

  9. BestCoder Round #86

    A题 Price List 巨水..........水的不敢相信. #include <cstdio> typedef long long LL; int main() { int T; ...

随机推荐

  1. 2017-2018-1 20179215《Linux内核原理与分析》第五周作业

    一.视频学习 1.系统调用的三层皮:xyz(API).system call(中断向量).sys_xyz(不同种类的服务程序). 2.Libc库定义个一些API引用了封装例程(wrapper rout ...

  2. linux shell查询

    查看当前版本可用的shell cat /etc/shells 查看当前使用的shell echo $0 查看当前用户默认使用的shell echo $SHELL

  3. 创建Azure Blob Snapshot的脚本

    在前面的文章中介绍了如何创建Azure Blob Snapshot.那篇文章中创建的脚本思路是:遍历所有Storage Account,找到所有vhd文件,进行Snapshot的创建. 但这种方式不够 ...

  4. MFC中如何不使用Unicode字符集

    命令窗口:调试->属性-> 把字符集设置为:未设置

  5. Java数组的基本讲解

    由于Java数组涵盖的内容比较多,这里从个人的角度对主要的内容进行相关的讲解. 如有不足,欢迎批评指正~ 1)Java数组是动态还是静态的啊?     Java语言是典型的静态语言,由此推断Java数 ...

  6. 【转载】ruby 中数组函数示例(1)(转)

    函数名称 说明 示例 &      数组与,返回两数组的交集 [1,2] & [2,3] =>[2]   * 复制数组n次 [1,2]*2       => [1,2,1, ...

  7. 自定义echart tooltip格式

    formatter: function (tipData) { return tipData[0].name + '</br>' + '<span style="displ ...

  8. File 类 操作实例

    File 操作 <介绍> 尽管java.io定义的大多数类是实行流式操作的,File类不是.它直接处理文件和文件系统.也就是说,File类没有指定信息怎样从文件读取或向文件存储:它描述了文 ...

  9. 27、BLASTN的参数

    转载:http://blog.sina.com.cn/s/blog_5ecfd9d90100ksui.html http://www.docin.com/p-704735699.html 与之前的bl ...

  10. VCF文件处理工具PyVCF

    vcf格式示例 ##fileformat=VCFv4.1 ##FILTER=<ID=LowQual,Description=”Low quality”> ##FORMAT=<ID=A ...