题解 | #汽水瓶#
汽水瓶
http://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
实现思路:两空瓶能换一瓶汽水,这是最小换算单位,所以直接除以2
import java.util.Scanner;
/**
* @author saint
* @date 2022/5/31
* @info 空瓶子换饮料
**/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNextInt()){
int num = sc.nextInt();
if(num <= 0){
break;
}
System.out.println(num/2);
}
}
}