Best Coder #86 1001 Price List(大水题)
Price List
There are nnn shops numbered with successive integers from 111 to nnn in Byteland. Every shop sells only one kind of goods, and the price of the iii-th shop's goods is viv_ivi.
Every day, Byteasar will purchase some goods. He will buy at most one piece of goods from each shop. Of course, he can also choose to buy nothing. Back home, Byteasar will calculate the total amount of money he has costed that day and write it down on his account book.
However, due to Byteasar's poor math, he may calculate a wrong number. Byteasar would not mind if he wrote down a smaller number, because it seems that he hadn't used too much money.
Please write a program to help Byteasar judge whether each number is sure to be strictly larger than the actual value.
The first line of the input contains an integer TTT (1≤T≤10)(1\leq T\leq 10)(1≤T≤10), denoting the number of test cases.
In each test case, the first line of the input contains two integers n,mn,mn,m (1≤n,m≤100000)(1\leq n,m\leq 100000)(1≤n,m≤100000), denoting the number of shops and the number of records on Byteasar's account book.
The second line of the input contains nnn integers v1,v2,...,vnv_1, v_2, ..., v_nv1,v2,...,vn (1≤vi≤100000)(1\leq v_i\leq 100000)(1≤vi≤100000), denoting the price of the iii-th shop's goods.
Each of the next mmm lines contains an integer qqq (0≤q≤1018)(0\leq q\leq 10^{18})(0≤q≤1018), denoting each number on Byteasar's account book.
For each test case, print a line with mmm characters. If the iii-th number is sure to be strictly larger than the actual value, then the iii-th character should be '1'. Otherwise, it should be '0'.
1
3 3
2 5 4
1
7
10000
001
#include <iostream>
#include <stdio.h>
#include <string.h>
#define N (1<<12)+5
#define M 12
using namespace std;
int main()
{
//freopen("in.txt","r",stdin);
int t;
long long a,b,n,m,s;
scanf("%d",&t);
while(t--)
{
s=;
scanf("%lld%lld",&n,&m);
for(int i=;i<n;i++)
{
scanf("%lld",&a);
s+=a;
}
for(int i=;i<m;i++)
{
scanf("%lld",&b);
if(b>s)
printf("");
else
printf("");
}
printf("\n");
}
return ;
}
Best Coder #86 1001 Price List(大水题)的更多相关文章
- BZOJ_1621_[Usaco2008_Open]_Roads_Around_The_Farm_分岔路口(模拟+大水题)
		
描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1621\(n\)头奶牛,刚开始在一起,每次分成\(x\)和\(x+m\)两部分,直到不能再分,问 ...
 - 第三届山西省赛1004 一道大水题(scanf)
		
一道大水题 时间限制: C/C++ 2000ms; Java 4000ms 内存限制: 65535KB 通过次数: 44 总提交次数: 1020 问题描述 Dr. Pan作为上兰帝国ACM的总负责人, ...
 - PAT甲题题解-1101. Quick Sort (25)-大水题
		
快速排序有一个特点,就是在排序过程中,我们会从序列找一个pivot,它前面的都小于它,它后面的都大于它.题目给你n个数的序列,让你找出适合这个序列的pivot有多少个并且输出来. 大水题,正循环和倒着 ...
 - PAT甲题题解-1117. Eddington Number(25)-(大么个大水题~)
		
如题,大水题...贴个代码完事,就这么任性~~ #include <iostream> #include <cstdio> #include <algorithm> ...
 - 【数据结构】 最小生成树(四)——利用kruskal算法搞定例题×3+变形+一道大水题
		
在这一专辑(最小生成树)中的上一期讲到了prim算法,但是prim算法比较难懂,为了避免看不懂,就先用kruskal算法写题吧,下面将会将三道例题,加一道变形,以及一道大水题,水到不用高级数据结构,建 ...
 - Wannafly挑战赛21:C - 大水题
		
链接:Wannafly挑战赛21:C - 大水题 题意: 现在给你N个正整数ai,每个数给出一“好数程度” gi(数值相同但位置不同的数之间可能有不同的好数程度).对于在 i 位置的数,如果有一在j位 ...
 - 大水题(water)
		
题目描述dzy 定义一个 $n^2$ 位的数的生成矩阵 $A$ 为一个大小为 $n \times n$ 且 Aij 为这个数的第 $i \times n+j-n$ 位的矩阵.现在 dzy 有一个数 $ ...
 - [BFS,大水题] Codeforces 198B Jumping on Walls
		
题目:http://codeforces.com/problemset/problem/198/B Jumping on Walls time limit per test 2 seconds mem ...
 - 补写:Best Coder #85 1001 Sum(前缀和)
		
sum Accepts: 640 Submissions: 1744 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/13107 ...
 
随机推荐
- EntityFramework 6.x多个上下文迁移实现分布式事务
			
前言 自从项目上了.NET Core平台用上了EntityFramework Core就再没碰过EntityFramework 6.x版本,目前而言EntityFramework 6.x是用的最多,无 ...
 - PuTsangTo
			
一. 跳跃与移动的优化与完善 先给上一次的内容做一次补救,也就是上一次中还留存的,由于键盘按键事件的第一次回调与后续回调之间会间隔个小半秒带来的跳跃落地后动作延迟的情况. 最终的键盘按下回调的处理代码 ...
 - SQLServer 自动循环归档分区数据脚本
			
标签:SQL SERVER/MSSQL SERVER/数据库/DBA/表分区 概述 在很多业务场景下我们需要对一些记录量比较大的表进行分区,同时为了保证性能需要将一些旧的数据进行归档.在分区表很多的情 ...
 - java复习要点(一)------- java语言的特点、java的工作原理、配置环境变量、java命令的使用
			
一.java语言的特点: (1)简单并面向对象 (2)鲁棒并安全: java语言在编译及运行程序时,都要进行严格的检查,防止不匹配问题的发生.如果引用一个非法类型,或执行一个非法类型操作,java减肥 ...
 - 通过修改 LayoutInflater,全局替换字体!!!
			
序 在 Android 下使用自定义字体已经是一个比较常见的需求了,最近也做了个比较深入的研究. 那么按照惯例我又要出个一篇有关 Android 修改字体相关的文章,但是写下来发现内容还挺多的,所以我 ...
 - Python系列之lambda、函数、序列化
			
lambda 在python中使用lambda来创建匿名函数,而用def创建的方法是有名称的,除了从表面上的方法名不一样外,python lambda还有哪些和def不一样呢? 1 python la ...
 - HDU1251统计难题(水字典树)
			
统计难题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Subm ...
 - es6零基础学习之项目目录创建(一)
			
和大家分享一下在学习es6的过程中所积累的东西,也希望更多的朋友能够互相学习 首先创建项目目录 打开你的命令行,什么文件下都可以,大家请随意,我自己用的git,输入 mkdir es6 创建一个完整的 ...
 - 如何判断Linux 是32位还是64位
			
.运行 'uname -m' 命令 上面的命令内涵太多了,可以用这个参数直指人心:'uname -m' . 例如,在我的系统里,它显示了以下信息: $ uname -m i686
 - 我修改的时钟flash
			
<object type="application/x-shockwave-flash" style="outline:none;" data=" ...