안녕하세요. 오늘은 저금을 할 거예요.

문제

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

아이디어

N<M인 동안 N*=1+B/100을 해주면 됩니다.

소스코드

#include <iostream>
using namespace std;

int main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	double N, B, M;

	while (cin >> N >> B >> M)
	{
		int cnt = 0;
		while (N < M)
		{
			cnt++;
			N *= 1 + B / 100;
		}
		cout << cnt << "\n";
	}
}


감사합니다.

0개의 댓글