# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
using namespace std;
const int MAXN = 1000;
int a[MAXN+1], b[MAXN+1];
char s[MAXN+3];
int main()
{
int n;
while(~scanf("%d",&n))
{
int ans1=0, ans2=0;
scanf("%s",s);
for(int i=0; i<n; ++i)
a[i] = s[i]+'0';
scanf("%s",s);
for(int i=0; i<n; ++i)
b[i] = s[i]+'0';
sort(a, a+n);
sort(b, b+n);
for(int i=0,j=0; i<n&&j<n; ++i)
{
while(j<n && b[j]<a[i])
++j;
if(j<n)
{
++ans1;
++j;
}
}
for(int i=0,j=0; i<n&&j<n; ++i)
{
while(j<n && b[j]<=a[i])
++j;
if(j<n)
{
++ans2;
++j;
}
}
printf("%d\n%d\n",n-ans1, ans2);
}
return 0;
}
CF777B:Game of Credit Cards(贪心)
最新推荐文章于 2024-06-18 07:30:00 发布