머쓱이는 추운 날에도 아이스 아메리카노만 마십니다. 아이스 아메리카노는 한잔에 5,500원입니다. 머쓱이가 가지고 있는 돈 money가 매개변수로 주어질 때, 머쓱이가 최대로 마실 수 있는 아메리카노의 잔 수와 남는 돈을 순서대로 담은 배열을 return 하도록 solution 함수를 완성해보세요.
| money | result |
|---|---|
| 5,500 | [1, 0] |
| 15,000 | [2, 4000] |
#include <string>
#include <vector>
using namespace std;
vector<int> solution(int money) {
vector<int> answer;
{
int americano = 5500;
int cup = money/americano;
int change = money%americano;
answer.push_back(cup);
answer.push_back(change);
}
return answer;
}
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
int* solution(int money) {
// return 값은 malloc 등 동적 할당을 사용해주세요. 할당 길이는 상황에 맞게 변경해주세요.
int* answer = (int*)malloc(sizeof(int)*2);
answer[0] = money/5500;
answer[1] = money%5500;
return answer;
}
또 너야 머쓱?! 그만... o((>ω< ))o