A - Codehorses T-shirts
题目大意:
- 根据题目要求要么不需要改要么只需要改动一个字母。
- so now Ksenia is required not to write the whole list from the scratch (擦去)but just(只能这样做) make some changes to the list of the previous year. In one second she can choose arbitrary position in any word and replace(任意位置进行置换) its character with some uppercase Latin letter. Ksenia can't remove or add letters in any of the words.(can't add and remove)
#include <bits/stdc++.h>
using namespace std;
#define maxn 115
int main()
{
int n,ans=0,i,j,flag;
string pre[maxn],cur[maxn];
cin>>n;
for(int i=0; i<n; i++)
cin>>pre[i];
for(int i=0; i<n; i++)
cin>>cur[i];
for(i=0; i<n; i++)
{
flag=1;
for( j=0; j<n; j++)
{
if(cur[i]==pre[j])
{
flag=0;
pre[j]='0';
break;
}
}
if(flag)
ans++;
}
cout<<ans<<endl;
return 0;
}
本文提供CodeForces-1000A题目的详细解析及高效解决方案,通过比较前后两年的T恤列表,实现快速查找与最小修改。
741

被折叠的 条评论
为什么被折叠?



