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 ...
随机推荐
- Safe Area Layout Guide
原文:Safe Area Layout Guide Apple在iOS 7中引入了topLayoutGuide和bottomLayoutGuide作为UIViewController属性.它们允许您创 ...
- NameError: name 'messagebox' is not defined 错误处理
写了段代码,想在按下button的时候跳个提示框出来,调试的时候提示了messagebox未定义 from tkinter import * def test_show(): messagebox.s ...
- Numpy中Meshgrid函数介绍及2种应用场景
近期在好几个地方都看到meshgrid的使用,虽然之前也注意到meshgrid的用法.但总觉得印象不深刻,不是太了解meshgrid的应用场景.所以,本文将进一步介绍Numpy中meshgrid的用法 ...
- Tree(uva 536)
先声明,我还在学习中,这个题大部分代码借鉴的大佬的,其实这算是比较经典二叉树题了,关键在于递归建树. 代码附上: #include <iostream> #include <cstr ...
- VPS修改SSH端口不小心把自己给墙掉的一般解决办法
很多人配置服务器的时候都习惯将 SSH 端口改为其他端口,以规避批量端口扫描,但也有不少人改完端口却忘了去防火墙修改端口,导致 SSH 登陆不上. 昨天我就这么干了 我把SSH端口从22改成了2345 ...
- Divide Sum 比赛时竟然想不出。。。。。。。
Divide Sum Time Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) SubmitSt ...
- Mysql主从复制原理及配置
Mysql主从复制原理及配置 1.复制概述 Mysql内建的复制功能是构建大型,高性能应用程序的基础.将Mysql的数据分布到多个系统上去,这种分布的机制,是通过将Mysql的某一台主机的数据复制到其 ...
- C-Flex 与 box布局教程
http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html -阮一峰老师 http://www.w3cplus.com/css3/flexbox- ...
- 在SQL中用正则表达式替换html标签(2)
由于数据库的一个表字段中多包含html标签,现在需要修改数据库的字段把html标签都替换掉.当然我可以通过写一个程序去修改,那毕竟有点麻烦.直接在查询分析器中执行,但是MS SQL Server并没有 ...
- Android 添加水印, 以及屏幕存取
/** * 获取水印 */ try { String s = CustomPreferences.getUserInfo().getAccountNo().substring(7,11); View ...