"카타 8급 The Feast of Many Beasts"의 두 판 사이의 차이

잔글 (봇: 카타 8급 PHP 분류 추가)
잔글 (봇: 자동으로 텍스트 교체 (-분류:PHP +))
41번째 줄: 41번째 줄:


[[분류:C++]]
[[분류:C++]]
[[분류:PHP]]
 
[[분류:카타 8급 PHP]]
[[분류:카타 8급 PHP]]

2019년 2월 3일 (일) 04:03 판

1 개요

카타 8급 C
# 🔗 문제 풀이

틀:카타 8급-45

2 C++

#include <string>

bool feast(std::string beast, std::string dish){
  return beast.front()==dish.front() && beast.back()==dish.back();
}
#include <string>

bool feast(std::string beast, std::string dish){
  if( beast.at(0) != dish.at(0) ) return false;
  if( beast.at(beast.length()-1) != dish.at(dish.length()-1) ) return false;
  return true;
}

3 PHP

function feast($beast, $dish) {
  return (($beast[0] === $dish[0]) && ($beast[strlen($beast) - 1] === $dish[strlen($dish) - 1]));
}
function feast($beast, $dish){
  if( $beast[0] != $dish[0] ) return false;
  if( $beast[strlen($beast)-1] != $dish[strlen($dish)-1] ) return false;
  return true;
}

4 같이 보기

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