bit 1003 Exchange for Cola

1237 단어 bit

Exchange for Cola


시간 제한: 1초 메모리 제한: 64M
Problem Description
The Cola company is holding a promotional activity that customerscan exchange B bottles of Cola with A caps. Now Silence has N caps. Furthermore, Silence can ask mm to borrow him some caps for anytimes as long as Silence is able to return the caps borrowed after he has used these caps to exchange Cola without buying any other Cola. Please tellSilence how many number of Cola Silence can drink.
Input
This problem contains multiple test cases. Each case contains oneline with three numbers N , A , B ,(1 <= N <= 10^9, 1 <= B < A <= 10^9), which have already been mentioned above.
Output
Print exactly one line with the maximal number of Cola Silence can drink by exchanging caps for each test case.
Sample Input
1 2 1
9 7 2
Sample Output

#include<stdio.h>
int main(){
	int N,A,B;

	while(~scanf("%d%d%d",&N,&A,&B)){
		//printf("%d",N*B/(A-B));
		printf("%d
",N/(A-B)*B); } return 0; }

좋은 웹페이지 즐겨찾기