프로그래머스 120883 로그인 성공?

Jmnote (토론 | 기여)님의 2023년 11월 7일 (화) 22:16 판 (새 문서: ==개요== {{프로그래머스|레벨=0|페이지=8}} ==C++== <syntaxhighlight lang='cpp'> #include <string> #include <vector> using namespace std; string solution(vector<string>...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요

프로그래머스 120883 로그인 성공?


2 C++

#include <string>
#include <vector>

using namespace std;

string solution(vector<string> id_pw, vector<vector<string>> db) {
    string id = id_pw[0];
    string pw = id_pw[1];
    for(auto& row: db) {
        if(row[0] != id) {
            continue;
        }
        if(row[1] == pw) {
            return "login";
        } else {
            return "wrong pw";
        }
    }
    return "fail";
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}