Title:
There is a Coco Cola store, you can use three empty bottles for a bottle of Coco Cola Drink, if you have n empty bottles, how many bottles of drink can you drink?
Input/Output requirements:
Intput: There are up to 10 groups of cases, each of which enters an integer and 0 is not manipulated.
Output: Each set of cases outputs the number of drinks you can drink.
Sample intput:
3
10
81
0
Sanple output:
1
5
40
The code is as follows:
#include <iostream>#include<cstdio>using namespacestd;intMain () {ints; while(SCANF ("%d", &s) &&s) {intf=0, t=0, M; T cannot be defined outside the loop body, otherwise the results of the previous group of cases will be added while(s>2) {f+=s/3; M=f-T; S=m+s%3; T=F; } if(s==2) F++; printf ("%d\n", F); } return 0;}
Variable definition location must be more attention!!!!
Write the question is very slag, Theseus do not have self-esteem, but female man still want to persist. There is nothing in the world to cure flat, but there are accidents in fact. If you come, you must conquer!
uva_11877. Third competition C: the Coco Cola