프로그래머스 레벨 1 테스트

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <cstdlib>
#include <string>
#include <vector>
 
using namespace std;
 
int solution(string s) {
    int answer = 0;
    
    answer = atoi(s.c_str());
    
    return answer;
}
 

C 스타일의 풀이법

 

1
2
3
4
5
6
7
8
9
10
11
12
#include <string>
#include <vector>
 
using namespace std;
 
int solution(string s) {
    int answer = 0;
    
    answer = stoi(s);
    
    return answer;
}

C++ 스타일의 풀이법

+ Recent posts