C++)
#include <string>
#include <vector>
using namespace std;
string solution(vector<string> seoul) {
int pos = 0;
for(auto name : seoul){
if (name == "Kim")
break;
pos++;
}
return "김서방은 " + to_string(pos) +"에 있다";
}
Python)
def solution(seoul):
return "김서방은 {}에 있다".format(seoul.index("Kim"))'프로그래머스 > Level1' 카테고리의 다른 글
| [Level1] 푸드 파이트 대회 (C++/Python) (0) | 2023.02.07 |
|---|---|
| [Level 1] 시저 암호 (C++/Python) (0) | 2021.01.08 |
| [Level 1] 수박수박수박수박수박수? (C++/Python) (0) | 2021.01.08 |
| [Level 1] 문자열을 정수로 바꾸기 (C++/Python) (0) | 2021.01.08 |
| [Level 1] 소수 찾기 (C++/Python) (0) | 2021.01.08 |