登录
首页 » Asm » q1

q1

于 2015-01-18 发布 文件大小:2KB
0 123
下载积分: 1 下载次数: 0

代码说明:

说明:  Pokeface 题目描述 魔术师将一叠扑克顺次在桌上排成一行,初始全部正面朝上。随后,他每次挥一挥衣袖,都会翻转一连串的扑克,改变它们的正反朝向。从古代传下来的规矩,魔术师皆有师傅,他们要随时准备回答师傅的问题。问题形如:目前从第i张扑克牌到第j张扑克牌中,有几张正面朝上? 作为魔术师的助手,你被要求学习程序设计、算法与数据结构。现在,魔术师把这个问题交给了你,你需要编写一个程序,维护相应的数据结构来保存桌子上牌面的情况,同时对于师傅的每一个问题,你要用尽量快的速度计算出答案。 输入 第一行包含三个正整数n、p和q。n表示扑克牌的数量,p表示魔术师的挥一挥次数,q表示师傅的问话次数。 接下来共p+q行,每行包含一个操作,操作分为2种: H i j 魔术师挥一挥,改变了第i张牌到第j张牌的正反 Q i j 师傅问话:截至目前,第i张到第j张牌中有多少张正面朝上 操作中恰好包含p次H操作,q次Q操作,与第一行的p和q吻合。H操作和Q操作的范围均包含边界(即第i张和第j张牌)。 对于每个操作,输入保证1 ≤ i ≤ j ≤ n。 输出 对于每次Q操作,输出一行,包含一个整数,表示问题的答案。 提示:线段树(Pokeface Title Description The magician will stack poker table sequentially in a row, all the initial face-up. He then every wisp will flip a series of poker pros and cons of changing their orientation. The rules handed down ancient times, the master magician Jie, they be ready to answer the teacher s questions. Question of the form: Currently playing cards i to j-card poker, there are a few face-up? As a magician s assistant, you are required to learn programming, algorithms and data structures. Now, the magician put this question to you, you need to write a program to maintain appropriate data structure to hold the cards on the table face the situation, while the master for each question, and you want to use as quickly calculate the answer. Enter The first line contains three positive integers n, p and q. n represents the number of poker, p represents the wave of the magic number, q represents the number of master s questioning. Next, a total of p+ q rows, each containi)

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 在制作安装序或在运行新序之前相关配置,利用该代码创建IIS服务器。...
    在制作安装程序或在运行新程序之前相关配置,利用该代码创建IIS服务器。-Installed in the production process or in the running before the new procedures related to configuration, use the code to create IIS server.
    2022-05-07 23:31:39下载
    积分:1
  • 计算机网络
    Computer Networking--A multithreaded Web server
    2023-09-06 06:55:03下载
    积分:1
  • 可以获取主机的name和ip,调用windows动态链接库,源代码非控件
    可以获取主机的name和ip,调用windows动态链接库,源代码非控件-can access mainframe name and ip, called Windows dynamic link libraries, source code control-
    2023-04-05 02:35:03下载
    积分:1
  • shuizhunwangpingcha
    利用C++实现水准网平差,水准网是为了确定地面点的高程而布设的控制网,水准网平差的目的是消除矛盾,求得各高程点高程的最可靠值。(Leveling network adjustment)
    2017-12-13 17:52:25下载
    积分:1
  • moulinette_printf
    A main of test for the function printf
    2011-05-14 04:35:15下载
    积分:1
  • YYLXHcitPos
    Good ERP System which I like mostly
    2015-10-04 00:59:31下载
    积分:1
  • Excel串口通讯
    在excel中加入串口通讯,可接收串口发来的数据,一行行显示,还有时间间隔显示(In Excel to add serial communication, you can receive data sent by the serial port, a line display, as well as time interval display)
    2017-09-07 15:49:54下载
    积分:1
  • RSEICal_ETM
    说明:  徐涵秋教授提出的遥感生态指数实现PYTHON代码 主要针对Landsat ETM数据实现的四种指标: 绿度 干度 湿度 温度 主要源自网络。(ealization of Python code by remote sensing ecological index proposed by Professor Xu Hanqiu This paper mainly aims at the four indicators of Landsat ETM data: Greenness Dryness humidity temperature Mainly from the network.)
    2020-05-23 14:00:02下载
    积分:1
  • CopyScreen
    C#截屏程序源代码,源代码完整,虽然简单,但功能挺好用。点击“截屏”后,用鼠标拖出一块区域,那就是你要截屏的区域,然后在选中区域上双击鼠标,可将截屏生成的JPG/GIF/PNG三种格式保存。代码在VS2005下顺利编译。(Screenshots C# source code, source code is complete, though simple, but functions quite good to use. Click on " screenshots" , the mouse pulled out a region, that is, you want screenshots of the area, and then double-click the mouse to select the region can be generated screenshots JPG/GIF/PNG three kinds of format. Code successfully compiled under VS2005.)
    2009-11-06 16:59:00下载
    积分:1
  • 隔震非隔震结构在El-centro地震波下反应
    集中质量串联模型,在El-centro地震波作用下的时程分析,并分析了隔震与非隔震支座下的顶层位移、速度、加速度的对比情况(The time series analysis of the concentrated mass series model under the action of El-centro seismic wave is carried out, and the comparison of the top displacement, velocity and acceleration under the condition of isolation and non isolation is analyzed.)
    2018-11-14 13:45:58下载
    积分:1
  • 696522资源总数
  • 104040会员总数
  • 35今日下载