Algorithm/기타(기업등)
[EPPER/15회 3번] 재고없는 날
IagreeBUT
2021. 3. 18. 22:12
728x90
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solution(int N,int M){
int day=0;
while(true){//노트북의 잔고가 0이 될때까지 반복됨
if(day%M==0) N++;
N--;
if(N==0)break;
day++;
}
return day;
}
int main() {
//N : 재고 M: 입고까지의 텀
int N,M;
cin>>N>>M;
cout<<solution(N,M);
return 0;
}
728x90