Link http://acm.hdu.edu.cn/showproblem.php?pid=5804
Test instructions: give you some store and his commodity price, and then give you an account book, ask you remember big is 1, otherwise is 0
Solution: Simulation, attention to test data size
#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 longusing 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,M Axn2;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