climbing-stairs-1

Alice is climbing stairs. There are total N stairs. She climbs A stairs upwards in day and she comes downstairs in night by B stairs. Find number of days she will take to reach the top of staircase.   

Input: 
First and only line contains three space separated integers denoting A, B, N.

Output: 
Print only one line of output denoting the answer to the question.

Constraints: 
1 ≤ B<A≤N ≤ 10^9

SAMPLE INPUT
5 1 6

SAMPLE OUTPUT
2

Source: hackerearth | Difficulty: EASY
Tags: Data structures

Mathematics

Ad-hoc


Solutions:
A, B, N = list(map(int, input().split(' ')))
X = (N - A) / (A - B) + 1
if (N - A) % (A - B) > 0:
	X = X + 1
print(X)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
str1=input()
arr=str1.split(' ')
a=int(arr[0])
b=int(arr[1])
n=int(arr[2])
interval=a-b
#stairs=0
days=int(n)/int(interval)
if n%interval>b:
	days=days+1
else:
	days=days-(b/interval)
print(days)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

import math

(A,B,N) = [int(x) for x in input().split(" ")]

if N <= A:
	print(1)
else:
	print(int(math.ceil(float(N-A)/(A-B)))+1)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

a,b,n=[int(n) for n in input().split(" ")]
d=(n-2*a)/(a-b)
l=d*(a-b)
while l+a<n:
	d+=1
	l=l+a-b
d+=1
print(d)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
A,B,N=list(map(int,input().split()))
numberofstairs=0
count=0
'''while N > numberofstairs:
	if count%2==0:
		numberofstairs+=A
	else:
		numberofstairs-=B
	count+=1
if count%2==0:
	print count
else:
	print count/2+count%2'''
if (N-B)%(A-B)==0:
	print((N-B)/(A-B))
else:
	print((N-B)/(A-B)+1)



l = list(map(int, input().split()))

a = l[0]
b = l[1]
n = l[2]

s = 0
c = 0

c = (n-a) // (a-b)
s = c * (a-b)

while True:
	s = s + a
	c += 1
	if s >= n:
	    break
	s = s - b
		
print(c)



import math

a,b,n = list(map(int,input().split()))
count = 1
n = n-a
count = count+math.ceil(n/(a-b))
print(int(count))


first_line = input()
first_line = first_line.split(' ')
A = int(first_line[0])
B = int(first_line[1])
N = int(first_line[2])
# print A,B,N
#
M = N-B

diff = (A-B)
div1 = N/diff
if N%diff>0:
	div1+=1

div2 = M/diff
if M%diff >0:
	div2+=1

print(min(div1,div2))


import math
a,b,n = list(map(float,input().split()))
print(int(math.ceil((n-b)/(a-b))))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

a,b,n=[int(n) for n in input().split(" ")]
d=(n-2*a)/(a-b)
l=d*(a-b)
while l+a<n:
	d+=1
	l=l+a-b
d+=1
print(d)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'

ip = input()
inps = ip.split()
a = int(inps[0])
b = int(inps[1])
n = int(inps[2])
day = 0
count = 0
z = a - b

day1 = n/z
if n%z:
	day1 = day1 + 1
	
day2 = (n-b)/z
if (n-b)%z:
	day2 = day2 + 1
	
if day1 > day2:
	print(day2)
else:
	print(day1)
'''
while count <= n:
	count = count + a
	day = day + 1
	if count < n:
		count = count - b
	else:
		break
print day'''
	


import math

A,B,N = [int (i) for i in input().split()]

print(int(math.ceil(1.0 *(N-B)/(A-B))))


l = list(map(int, input().split()))

a = l[0]
b = l[1]
n = l[2]

s = 0
c = 0

c = (n-a) // (a-b)
s = c * (a-b)


while True:
	s = s + a
	c += 1
	if s >= n:
	    break
	s = s - b
		
print(c)


A,B,N = list(map(float, input().split(' ')))
from math import *
print(int(ceil((N-B)/(A-B))))


A,B,N=list(map(int,input().split()))
steps_per_day=A-B
stairs=N-A
days=stairs/steps_per_day
left_stairs=stairs%steps_per_day
if left_stairs==0:
	print(days+1)
else:
	print(days+2)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
i=0
c=0
s=input()
li=[]
li=(s.split(" "))
u=int(li[0])
d=int(li[1])
t=int(li[2])
n=u-d;

c=int(t/n)
c=c+1
while(((n*c)+d)>=t):
	c=c-1
c=c+1

  
print(c)


'''
# Read input from stdin and provide input before running code

Alice is climbing stairs. There are total N stairs. She climbs A stairs upwards in day and she comes downstairs in night by B stairs. Find number of days she will take to reach the top of staircase.

Input: 
First and only line contains three space separated integers denoting A, B, N.

Output: 
Print only one line of output denoting the answer to the question.

Constraints: 
1 ? B<A?N ? 109

SAMPLE INPUT 
5 1 6
SAMPLE OUTPUT 
2

'''
str1=input()
arr=str1.split(' ')
a=int(arr[0])
b=int(arr[1])
n=int(arr[2])
interval=a-b
#stairs=0
#print n
#print interval
#print n/interval
#print n%interval
days=int(n)/int(interval)
if n%interval>b:
	days=days+1
else:
	days=days-(b/interval)
print(days)
	


#!/usr/bin/env python
# -*- coding: utf-8 -*-

# https://www.hackerearth.com/gsf-hacks/algorithm/climbing-stairs-1/

A, B, N = [int(x) for x in input().split()]
if (N - A) % (A - B) == 0:
	print(((N - A) // (A - B) + 1))
else:
	print(((N - A) // (A - B) + 2))


import math
a, b, n = input().split(' ')
res = 1.0*(int(n)-int(b))/(int(a)-int(b));
print(int(math.ceil(res)))