链接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. phpunit手动配置

    phpunit: #!D:\xampp\php\.\php.exe<?php/* PHPUnit * * Copyright (c) 2001-2013, Sebastian Bergmann ...

  2. Unity中的ShaderToys——将大神们写的shader搬到unity中来吧

    http://lib.csdn.net/article/unity3d/38699 这篇文章翻译自国外的一篇文章(这里是原文链接),正在使用unity的你是否在shader toy上发现很多牛逼哄哄的 ...

  3. [转]基于phantomJS实现web性能监控

    1.web性能监控背景描述 上期分享的<Web性能监控自动化探索之路–初识WebPageTest>从依赖webpagetest的角度给出了做性能日常检查的方案,但由于依赖结构相对复杂我们需 ...

  4. c++11中用_sntprintf代替_stprintf

    sprintf.swprintf 分别是对单字节/双字节字符格式化的,wsprintf根据预定义指示符的不同可以对单字节/双字节字符格式化. wsprintf和swprintf比较,其实这两个函数对用 ...

  5. HTTP 的若干问题

    1  HTTP无状态协议和Connection:Keep-Alive容易犯的误区 HTTP无状态:无状态是指协议对于事务处理没有记忆能力,服务器不知道客户端是什么状态.从另一方面讲,打开一个服务器上的 ...

  6. 十六、xx.xx.xx格式版本号大小比较

    DELIMITER $$ USE `deshangshidai`$$ DROP FUNCTION IF EXISTS `STRCMP_MY_VERSION`$$ CREATE DEFINER=`roo ...

  7. VC6.0 工程转到VS2010一些问题的描述及解决方法

    下列为VC6.0 工程转到VS2008一些问题的描述及解决方法 //////////////////////////////////////////////////////////////////// ...

  8. shell入门-变量

    shell变量分为系统变量和用户自定义变量 查看变量的命令 #env        系统变量 或者 #set    包括env和自定义变量和额外变量 使用变量的命令是 #echo $[变量] //// ...

  9. 使用python ftplib包递归下载文件夹及文件

    #!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-06-11 09:35:49 # @Author : Yaheng Wang ...

  10. ASP.NET Core 身份认证 (Identity、Authentication)

    Authentication和Authorization 每每说到身份验证.认证的时候,总不免说提及一下这2个词.他们的看起来非常的相似,但实际上他们是不一样的. Authentication想要说明 ...