본문 바로가기

Programming/BaekJoon

[C++] 백준 5032번 : 탄산 음료


https://www.acmicpc.net/problem/5032




#include <iostream>

using namespace std;

int main() {

int e,f,c;

cin >> e >> f >> c;


int cnt = 0, tmp;

tmp = e + f;


do {

cnt = cnt + tmp / c;

tmp = tmp / c + tmp % c;

} while (tmp >= c);


cout << cnt;

}