From 34c6072200495872dbfa081f2382c9d427643f5c Mon Sep 17 00:00:00 2001 From: KiritoTRw <3021577574@qq.com> Date: Mon, 2 May 2016 13:59:16 +0800 Subject: [PATCH] Create 1099_HBat.cpp From https://vijos.org/p/1291/solution --- QUSTOJ/1099_HBat.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 QUSTOJ/1099_HBat.cpp diff --git a/QUSTOJ/1099_HBat.cpp b/QUSTOJ/1099_HBat.cpp new file mode 100644 index 0000000..c0474da --- /dev/null +++ b/QUSTOJ/1099_HBat.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +using namespace std; + +int n,m,a[2010],t[2010]; +int main() +{ + scanf("%d%d",&n,&m); + for(int i=1;i<=n;i++) + scanf("%d",&a[i]); + for(int i=1;i<=m;i++) + scanf("%d",&t[i]); + int left=m; + sort(t+1,t+m+1); + for(int i=1;i<=n;i++) + { + for(int j=m;j>0;j--) + { + if(a[i]>t[j]&&t[j]!=0) + { + t[j]=0; + left--; + break; + } + } + } + printf("%d",left); +}