class Solution {
public:

    

    /**
     * 
     * @param n int整型 
     * @return int整型
     */
    int climbStairs(int n) {
        // write code here
        if(n <= 2)return n;

        int low_1 = 2;//比当前层数还低一层,有“2”种方法爬上
        int low_2 = 1;//比当前层数还低两层,有“1”种方法爬上
        int curr_state;
        for(int i=3; i<=n; ++i){
            curr_state = low_1 + low_2;//当前层数,有“low_1 + low_2”种方法爬上
            low_2 = low_1;
            low_1 = curr_state;
        }

        return curr_state;
    }
};