class Chain {
public:
    int findK(int n) {
        if(n%3==0)
return n/2;
        return (n+1)/2;
    }
};

刚才找规律竟然过了。。。