题解 | #汽水瓶#
汽水瓶
http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int input = Integer.parseInt(sc.nextLine());
if (input != 00) {
printResult(input);
} else {
break;
}
}
}
public static void printResult(int n) {
int count = 0;
while (true) {
int x = n / 3;
count += x;
int y = n % 3;
n = x + y;
if (n == 2) {
count++;
break;
}
if (n == 1) {
break;
}
}
System.out.println(count);
}
}

