力扣-319题 灯泡开关(C++)- 找规律

题目链接:https://leetcode-cn.com/problems/bulb-switcher/
题目如下:
在这里插入图片描述
在这里插入图片描述

class Solution {
    
    
public:
    int bulbSwitch(int n) {
    
    
        return sqrt(n+0.5);
    }
};

おすすめ

転載: blog.csdn.net/qq_40467670/article/details/121343989