leetcode319
public class Solution {
public int BulbSwitch(int n) {
var x = Math.Sqrt(n);
var y = Convert.ToInt32(Math.Floor(x));
return y;
}
}
https://leetcode.com/problems/bulb-switcher/#/description
leetcode319的更多相关文章
- [Swift]LeetCode319. 灯泡开关 | Bulb Switcher
There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every ...
- Leetcode319. Bulb Switcher灯泡开关
初始时有 n 个灯泡关闭. 第 1 轮,你打开所有的灯泡. 第 2 轮,每两个灯泡你关闭一次. 第 3 轮,每三个灯泡切换一次开关(如果关闭则开启,如果开启则关闭).第 i 轮,每 i 个灯泡切换一次 ...
- LeetCode 319
Bulb Switcher There are n bulbs that are initially off. You first turn on all the bulbs. Then, you t ...
随机推荐
- 阿里云 linux 找回mysql root密码
不小心手贱修改了密码,而且使用phpMyAdmin这种自动生成密码,又没记录密码,真实醉了 搜了半天,问题多多,想过回滚磁盘到昨天,在阿里云已经买了付费找密码 最后终于自己解决了,其实很简单 cd ...
- LINQ(数据查询)
如果只有空的构造函数,想要对字段进行初始化,可以直接在构造函数后面加上{属性名=值,属性名=值};属性与属性之间用,分割开 //查询所有武学级别大于8的武林高手 //var res = new Lis ...
- js设计模式理解干货
构造函数本身就是一个函数,只不过该函数是出于创建对象的目的而定义的. 创建Object实例的两种方式: new 操作符 var person = new Object(); person.name = ...
- Javascript-我对作用链、闭包、原型及原型链的理解
Javascript-基础概念总结(2) 最近学习一些javascript基础知识,也解决了很多之前的疑惑,记得第一次被问及怎样理解闭包时,我的回答是:就是类似于封装吧!现在想想是有多白痴,学习技术是 ...
- SMOTE RF MLP demo use cross_val_score to find best argument 处理不平衡数据的demo代码 先做smote处理 再用交叉验证找到最好的模型参数 实践表明MLP更好
# _*_coding:UTF-8_*_ from sklearn.externals.six import StringIO from sklearn import tree import pydo ...
- vue-router使用next()跳转到指定路径时会无限循环
我在路由为 /path 的页面这样写 beforeRouteLeave (to, from, next) { console.log('离开路路由') if(to.fullPath==='/home' ...
- @angular/cli项目构建--modal
环境准备: cnpm install ngx-bootstrap-modal --save-dev impoerts: [BootstrapModalModule.forRoot({container ...
- New Concept English three (51)
22 76 Predicting the future is notoriously difficult. Who could have imagined, in the mid 1970s, for ...
- HDU - 5307 :He is Flying (分治+FFT)(非正解)
JRY wants to drag racing along a long road. There are nn sections on the road, the ii-th section has ...
- codevs 2503 失恋28天-缝补礼物
题目描述 Description 话说上回他给女孩送了n件礼物,由于是廉价的所以全部都坏掉了,女孩很在意这些礼物,所以决定自己缝补,但是人生苦短啊,女孩时间有限,她总共有m分钟能去缝补礼物.由于损坏程 ...