Educational Codeforces Round 46 (Rated for Div. 2) A. Codehorses T-shirts

Bryce1010模板

http://codeforces.com/problemset/problem/1000/A
题意:
问你将一种类型的衣服转换成另一种的最小次数。

#include
using namespace std;

#define ll long long
ll a[5][5],b[5][5];
int main(){
    ll n;
    cin>>n;
    string s;
    for(ll i=0;icin>>s;
        ll len=s.size();
        for(ll j=0;jif(s[j]=='S')
                a[j][0]++;
            else if(s[j]=='L')
                a[j][1]++;
            else if(s[j]=='M')
                a[j][2]++;
        }
    }
    for(ll i=0;icin>>s;
        ll len=s.size();
        for(ll j=0;jif(s[j]=='S')
                b[j][0]++;
            else if(s[j]=='L')
                b[j][1]++;
            else if(s[j]=='M')
                b[j][2]++;
        }
    }
    ll ans=0;
    for(ll i=0;i<3;i++)
    {
        for(ll j=0;j<4;j++)
        {
            if(a[j][i]>b[j][i])
                ans+=a[j][i]-b[j][i];
        }
    }
    cout<return 0;
}

你可能感兴趣的:(codefoces)