https://www.acmicpc.net/problem/2869
2869번: 달팽이는 올라가고 싶다
첫째 줄에 세 정수 A, B, V가 공백으로 구분되어서 주어진다. (1 ≤ B < A ≤ V ≤ 1,000,000,000)
www.acmicpc.net
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int A, B, V; cin >> A >> B >> V;
int top = V - A; int mod = A - B;
int answer = top / mod;
if (top % mod > 0) answer++;
cout << answer+1 << endl;
return 0;
}
'전공공부 > 코딩테스트' 카테고리의 다른 글
(c++) 백준 "1436) 영화감독 슘" (0) | 2022.06.03 |
---|---|
(c++) 프로그래머스 "가장 긴 펠린드롬" (0) | 2022.06.02 |
(c++) 백준 "2775) 부녀회장이 될테야" (0) | 2022.06.02 |
(c++) 백준 "1259) 팰린드롬수" (0) | 2022.06.02 |
(c++) 백준 "15829)Hashing" (0) | 2022.06.02 |