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 ...
随机推荐
- 0.00-050613_ZC_Chapter4_20151230
1. 32位 保护模式 段选择符 --> 段描述符(段描述符表) --> 段基地址 + 偏移量 ==> 线性地址(ZC: 这个地址就是段的开始地址) 1.2. 段限长字段LIMIT ...
- CentOS6.4x84挂载U盘
root用户登录 1. 查看磁盘情况: fdisk -l 信息如下: [root@CentOS6 ~]# fdisk -l Disk /dev/sda: 128.8 GB, 128849018880 ...
- jquery下json数组的操作用法实例
jquery下json数组的操作用法实例: jquery中操作JSON数组的情况中遍历方法用的比较多,但用添加移除这些好像就不是太多了. 试过json[i].remove(),json.remove( ...
- The tag handler class for "home.jsp" (org.apache.taglibs.standard.tag.rt.core.ForEachTag) was not found on the Java Build Path
web.xml中 listener,filter,servlet需按顺序. <listener> <listener-class>listener.VisitCountList ...
- Python爬虫之利用BeautifulSoup爬取豆瓣小说(一)——设置代理IP
自己写了一个爬虫爬取豆瓣小说,后来为了应对请求不到数据,增加了请求的头部信息headers,为了应对豆瓣服务器的反爬虫机制:防止请求频率过快而造成“403 forbidden”,乃至封禁本机ip的情况 ...
- 如何学习Android系统源码(转)
一. Android系统的源代码非常庞大和复杂,我们不能贸然进入,否则很容易在里面迷入方向,进而失去研究它的信心.我们应该在分析它的源代码之前学习好一些理论知识,下面就介绍一些与Android系统相关 ...
- GEF入门实例_总结_01_教程、源码、开发环境准备
一.前言 最近在学Eclipse插件开发,发现了一个比较好的GEF入门教程,并且按照教程上的操作,一步步实现了一个入门Demo,在此感谢作者的贡献. 好记性不如烂笔头,故决定总结一下这段时间的学习心得 ...
- kylin_异常_01_java.io.FileNotFoundException: /developer/apache-kylin-2.3.0-bin/tomcat/conf/.keystore
一.异常现象 kylin安装完,启动后,控制正常,kylin后台也能正常访问.但是去看kylin的日志,却发现报错了: SEVERE: Failed to load keystore type JKS ...
- LeetCode OJ:Binary Tree Preorder Traversal(前序遍历二叉树)
Given a binary tree, return the preorder traversal of its nodes' values. For example:Given binary tr ...
- hdu-5183-Negative and Positive (NP)(hash模板)
题目链接 #include <iostream> #include <cstdio> #include <cstring> #include <algorit ...