题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.time.LocalDateTime; import java.util.*; import java.util.stream.IntStream; import java.util.stream.Stream; public class Main { public static void main(String[] args) throws IOException { //testCompletePack(); testTh(); } private static void testTh() throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); String str; while ((str = bf.readLine()) != null) { int parseInt = Integer.parseInt(str); if (parseInt == 0)break; int res = 0; while (parseInt >= 3) { res++; parseInt = parseInt - 3; parseInt++; } if (parseInt == 2)res++; System.out.println(res); } } }