汽水瓶
汽水瓶
http://www.nowcoder.com/questionTerminal/fe298c55694f4ed39e256170ff2c205f
import java.util.Scanner; public class Main { private int cal(int number) { int bottoms = 0; while (number >= 3) { bottoms += number/3; number = number%3 + number/3; } if (number == 2) { bottoms++; } return bottoms; } public Main() { Scanner in = new Scanner(System.in); while (in.hasNextInt()) { int number = in.nextInt(); if (number == 0) break; int result = cal(number); System.out.println(result); } } public static void main(String[] args) { Main solution = new Main(); } }