카타 8급 Sort and Star

Jmnote bot (토론 | 기여)님의 2020년 11월 2일 (월) 02:48 판 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 C++[ | ]

std::string twoSort(std::vector<std::string> s)
{
  std::string res = *min_element(s.begin(), s.end());
  for(int i=1; i<res.length(); i+=4) res.insert(i, "***");
  return res;
}
std::string twoSort(std::vector<std::string> s)
{
  std::string m = *(min_element(s.begin(), s.end()));
  std::string res;
  for (int i = 0; i<m.length(); i++) {
    res += m[i];
    if(i != m.length()-1) res += "***";
  }
  return res;
}
std::string twoSort(std::vector<std::string> s)
{
  std::string m = *(min_element(s.begin(), s.end()));
  std::string res= m.substr(0,1);
  for(int i=1; i<m.length();i++) {
    res += "***" + m.substr(i,1);
  }
  return res;
}

2 PHP[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}