Locker doors

算法——Locker doors 题目描述 There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the ith pas... 阅读详情
Locker doors
1000(ms)
65535(kb)
1079 / 3739
There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the ith pass, i = 1, 2, ..., n, you toggle the door of every ith locker: if the door is closed, you open it, if it is open, you close it. For example, after the first pass every door is open; on the second pass you only toggle the even-numbered lockers (#2, #4, ...) so that after the second pass the even doors are closed and the odd ones are opened; the third time through you close the door of locker #3 (opened from the first pass), open the door of locker #6 (closed from the second pass), and so on. After the last pass, which locker doors are open and which are closed? How many of them are open?Your task is write a program to output How many doors are open after the last pass? Assumptions all doors are closed at first.
输入
a positive numbers n, total doors. n<=100000
输出
a positive numbers ,the total of doors opened after the last pass.
样例输入
10
样例输出
3
#include<iostream> 
#include<stdio.h> 
#include<malloc.h>
#include<string.h>
#include<string>
#include<math.h>
using namespace std;

 

int main() {
	int x;
	while(cin>>x){
		int y=sqrt(x);
		cout<<y<<endl;
	}
}
locker源码 立即下载

相关推荐

告别爆显存!手把手教你为ComfyUI+华为Atlas 300I Duo配置wan2.1视频生成工作流(含CPU-VAE参数)

本文详细介绍了华为Atlas 300I Duo与ComfyUI的深度适配实战,重点优化wan2.1视频生成工作流。从硬件散热改造到软件栈配置,再到ComfyUI专项优化,提供完整的解决方案,显著提升视频生成效率与稳定性,特别适合需要高效文生视频的应用场景。

weixin_26812607的博客 467

locker doors问题

 locker doors锁门的问题(C++):Description There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time star

Steven Well的专栏 3135

【Matterport3D模拟器安装详细教程】适用于离散视觉语言导航任务的环境部署与安装

请注意,本文特指在环境下的安装!

六六六六神的博客 6794

SWUST OJ 480: Locker doors

SWUST OJ 480: Locker doors

Knight 1602

3.1 计算机视觉的发展和卷积神经网络概要(百度架构师手把手带你零基础实践深度学习原版笔记系列)

3.1 计算机视觉的发展和卷积神经网络(百度架构师手把手带你零基础实践深度学习原版笔记系列) 概要 计算机视觉作为一门让机器学会如何去“看”的科学学科,具体的说,就是让机器去识别摄像机拍摄的图片或视频中的物体,检测出物体所在的位置,并对目标物体进行跟踪,从而理解并描述出图片或视频里的场景和故事,以此来模拟人脑视觉系统。因此,计算机视觉也通常被叫做机器视觉,其目的是建立能够从图像或者视频中“感知”信息的人工系统。 计算机视觉技术经过几十年的发展,已经在交通(车牌识别、道路违章抓拍)、安防(人脸闸机.

aiAI 692

Unity Shader之路(一)什么是Unity Shader?

Unity Shader前言什么是UnityShaderUnity Shader和材质的关系 前言 众所周知,要想当游戏开发工程师,Unity中的Shader编写不得不摸,这一系列文章我将描写我的Shader学习之路,致敬冯乐乐的书Unity Shader入门精要,此篇什么是Unity Shader?希望能给后人一点方向 我们刚开始接触Unity的时候,总是会遇到材质,但是不了解材质都是什么,为什么可以在很多材质中选择,为什么有时候选择了其他材质后就不能达到我们想要的结果,为什么资源商店有那么多的材质,山.

TurboQ珞珈 2242

SWUST OJ 480:Locker doors

题目描述: There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the ith pass, i = 1, 2, ..., n, you toggle the door of every ith

m0_56350033的博客 850

国产麒麟V10系统命令大全,100个实用命令助你玩转系统!

国产麒麟V10系统命令大全,100个实用命令助你玩转系统!

网络技术联盟站 1915

Locker doors 一个坑爹的问题

Locker doors 1000(ms) 65535(kb) 1100/3790 There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, eac...

孤月水明 2488

IDCNBSAIS-财务报表功能范围取值管理费用、销售费用、研发费用排除指定科目的实现

研究了很多方法,没有办法实现,只在营业费用增加一个冲抵项解决,也咨询了外部顾问说要建立自建表。限于需要马上修正后面只能用了最最low的办法处理了一下。公司遇到的一个问题,目前报表有些项目是按照功能范围取值的,发现取多了。IDCNBSAIS-财务报表功能范围取值管理费用、销售费用、研发费用排除指定科目的实现。最后结果是正确的,但是总觉得有更好的办法,不知道有没有高人可以指点一下?建立一个调整项的目录,在每个节点做了调整。除了研发费用做了冲抵在以下每个节点都做了冲抵。为财务报表定义表格结构。

nopicture的博客 1495

智能车图像处理12-进阶篇4--环岛辅助判断条件

主函数: 第6行: 含义是当前需要不在坡道和车库状态 第11-12行 : 寻找一下环岛的双断点(在辅助函数中) 第16-66行: 当左右线的方差满足一边很大,一边很小时,truepianfangflag /truepianfangflagforleft 置1,在环岛的判断中使用。 辅助函数: 双断点函数(左与右相似,以做为例): 第13-28行: 第一处断点 第29-40行: 第一处断点后 连续边线 第41-52行: 第一处连续后,第二处断点 第53-64行: 第二处断点后,第二处

taiyuezyh的博客 1万+

480: Locker doors

题目描述 There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the ith pas...

ZHappyDragon的博客 1008

Python 爬虫反爬突破:浏览器指纹深度伪装技术

在当前网络安全与反爬虫技术日趋成熟的环境下,传统的请求头伪装、IP 代理已无法满足复杂站点的爬虫需求。浏览器指纹作为网站识别爬虫、区分真实用户与自动化程序的核心技术,成为爬虫进阶必须突破的关键壁垒。浏览器指纹通过采集浏览器环境、硬件信息、渲染特性等多维数据生成唯一标识,即使更换 IP、清除 Cookie,网站仍可精准识别爬虫程序。本文聚焦浏览器指纹深度伪装技术,从指纹生成原理、核心指纹类型、Python 实现方案、高匿伪装实战到风控绕过策略,全方位讲解浏览器指纹的突破方法。Selenium 官方文档。

2503_91057718的博客 641

关于Locker doors 的算法

Locker doors There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On th...

Bad_lemon的博客 1158

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

SWUSTOJ 0480 Locker Doors

问题描述: There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the ith pa...

swust0137的博客 725

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

SWUST OJ#480 Locker doors

最初,所有储物柜的门都是关闭的。例如,你拨动每一个储物柜的门:如果门是关着的,你就打开它,如果是开着的,你就关上它。例如,在第一次通过后,每扇门都是打开的;在第二次通过时,你只需要切换偶数号的储物柜(#2,#4,…),这样在第二次通过后偶数号的门就会关闭,奇数号的门就会打开;第三次你要关闭3号储物柜的门(在第一次通过时打开),打开6号储物柜的门(在第二次通过时关闭),以此类推。最后一关后,哪些储物柜门是开着的,哪些是关着的?你的任务是写一个程序输出在最后一关后有多少门是打开的?

haoranyyy的博客 627

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

SWUSTOJ 480: Locker doors

走廊里有n个储物柜,从1到n依次编号。最初,所有的储物柜门都是关闭的。你经过储物柜n次,每次都从1号储物柜开始。,n、 你拨动每个第i个储物柜的门:如果门关着,你就打开它,如果门开着,你就会关上它。例如,第一次通过后,每个门都打开了;),以便在第二个通过后,偶数门关闭,奇数门打开;第三次通过你关闭3号储物柜的门(从第一次通过打开),打开6号储物柜的大门(从第二次通过关闭),以此类推。最后一次通过后,哪些储物柜的门是打开的,哪些是关闭的?你的任务是编写一个程序来输出最后一次通过后打开了多少扇门?

qq_52327660的博客 943

swust oj 480: Locker doors

题目描述 There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the ith pass, i = 1, 2, ..., n, you toggle the door of every ith l

qq_53746035的博客 975

480 Locker doors(swust oj)

** 题目描述 ** There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the i...

yxt_tian的博客 1584

SWUSTOJ #480 Locker doors

There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed.

oafseoases 2632

swustoj Locker doors(0480)

Description There are n lockers in a hallway numbered sequentially from 1 to n. Initially, all the locker doors are closed. You make n passes by the lockers, each time starting with locker #1. On the

pawn2015的博客 1251

【算法----->Locker Doors】

Locker Doors 算法题java版本

weixin_50158551的博客 803
上一篇: 翻煎饼问题swust oj~~~254
下一篇: The Josephus Problem
CGD_ProgramLife
博客等级 码龄9年 11粉丝 64原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值