C언어 문제풀이
백준 2869번: 달팽이는 올라가고 싶다
지식보부상님
2021. 1. 3. 18:38
백준 2869번
문제: www.acmicpc.net/problem/2869
2869번: 달팽이는 올라가고 싶다
첫째 줄에 세 정수 A, B, V가 공백으로 구분되어서 주어진다. (1 ≤ B < A ≤ V ≤ 1,000,000,000)
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int A, B, V;
int n, N, i;
scanf("%d %d %d", &A, &B, &V);
if (V < A)
printf("1");
else {
n = (V - A) / (A - B)+1;
if ((V - A) % (A - B)) n++;
printf("%d", n);
}
return 0;
}
|
cs |