코딩테스트/프로그래머스
[프로그래머스] 코딩테스트 입문 Day5
쪼르뚜
2023. 5. 24. 00:19
728x90
반응형
//옷가게 할인 받기
int solution(int price) {
if(price>=500000){
return trunc(price*0.8);
}else if(price>=300000){
return trunc(price*0.9);
}else if(price>=100000){
return trunc(price*0.95);
}else{
return price;
}
}
//아이스 아메리카노
vector<int> solution(int money) {
vector<int> answer;
answer.push_back(money/5500);
answer.push_back(money%5500);
return answer;
}
//나이 출력
int solution(int age) {
return 2023-age;
}
//배열 뒤집기
vector<int> solution(vector<int> num_list) {
reverse(num_list.begin(), num_list.end());
return num_list;
}
꾸준히 해야지 했는데 텀이 너무 길어졌다....
자기 전에 마지막 에너지 쓰기~

728x90
반응형