给👴气死了

首先,老实人做法,数学题嘛:

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = 0;
        while((i = sc.nextInt()) != 0)
        if(i != 0)
        System.out.println(exchange(i));
    }
    
    public static int exchange(int nums){
        int colar = 0;
        int bottle = 0;
        colar += nums / 3;
        bottle += nums % 3 + colar;
        while(bottle >= 3){
        colar += bottle / 3;
        bottle -= bottle / 3 * 2; //原式:bottle = bottle - bottle / 3 * 3 + bottle / 3
        }
        if(bottle == 2)
            colar ++;
        return colar;
    }
}

但是这tm居然是个脑筋急转弯!

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int i = 0;
        while((i = sc.nextInt()) != 0)
        if(i != 0)
        System.out.println(i / 2);
    }

}

没错,除以二就是正确答案,吃了没文化的亏。。。