안녕하세요. 오늘은 팀 이름을 정해볼 거예요.
https://www.acmicpc.net/problem/1296
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
string yeondu;
int percent(string s)
{
int L = 0, O = 0, V = 0, E = 0;
for (char c : yeondu)
{
if (c == 'L') L++;
if (c == 'O') O++;
if (c == 'V') V++;
if (c == 'E') E++;
}
for (char c : s)
{
if (c == 'L') L++;
if (c == 'O') O++;
if (c == 'V') V++;
if (c == 'E') E++;
}
return ((L + O) * (L + V) * (L + E) * (O + V) * (O + E) * (V + E)) % 100;
}
bool cmp(string s, string s2)
{
if (percent(s) != percent(s2)) return percent(s) > percent(s2);
return s < s2;
}
int main(void)
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
vector <string> v;
int N, i;
cin >> yeondu >> N;
for (i = 0; i < N; i++)
{
string s;
cin >> s;
v.push_back(s);
}
sort(v.begin(), v.end(), cmp);
cout << v[0];
}
감사합니다.