登录
首页 » Asm » q1

q1

于 2015-01-18 发布 文件大小:2KB
0 213
下载积分: 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 个回复

  • thread safety examples. Description of the procedures for the security thread. T...
    线程安全实例。该程序说明线程安全问题。该例子实现的功能与多线程并发服务器实例的类似,但增加了一个客户数据存储功能,即服务器将存储每个连接客户所发来的所有数据,当连接终止后,服务将显示客户的名字及相应的数据。-thread safety examples. Description of the procedures for the security thread. The examples of the functions and multi-threaded server with similar examples, but the addition of a customer data storage function, which is to store each server will connect customers come in all the data, when connected after termination of service customers will show the names and corresponding data.
    2022-02-05 20:02:18下载
    积分:1
  • The-use-of-the-stack-
    C++利用栈求表达式课程设计包含文件试题库的运用(C++ using the stack for the expression of curriculum design examination questions library contains documents using)
    2011-11-19 13:18:58下载
    积分:1
  • JWT
    WIND WITH CONSTANT WITH WIND SPEED
    2013-12-03 13:14:16下载
    积分:1
  • NJ
    实验停车场管理,用C++,在VC++6.0下运行(Parking management experiment with C++, running under VC++6.0)
    2014-01-05 22:57:20下载
    积分:1
  • KF_filter
    说明:  卡尔曼滤波在CV、CA模型中的应用以及卡尔曼滤波应用于圆周运动的跟踪(Application of Kalman filter in CVCA model and application of Kalman filter in Circular motion model)
    2021-04-24 15:48:47下载
    积分:1
  • 一个简单在线日历的实现过,利用asp开发。
    一个简单在线日历的实现过程,利用asp开发。-a simple online calendar of the implementation process, using asp development.
    2022-04-17 00:57:29下载
    积分:1
  • x under the rdp protocol, Remote Desktop system, based on nano
    x下的rdp协议,远程桌面系统,基于nano-x-x under the rdp protocol, Remote Desktop system, based on nano-x
    2022-06-20 18:47:14下载
    积分:1
  • caiyong98889
    LabVIEW虚拟示波器程序,采用ART USB2831数据采集卡,具有多路数据采集存储和回放功能(LabVIEW virtual oscilloscope program, the use of ART USB2831 data acquisition card, with multi-channel data acquisition, storage and playback function)
    2017-07-06 15:19:15下载
    积分:1
  • CoreTextWrapper
    core text 效果的源代码,用于排版,效果不错,欢迎大家下载(core text resource)
    2012-12-30 22:06:30下载
    积分:1
  • showBMP
    说明:  基于MFC单文档,能够在MFC中显示BMP格式图片的程序(Based on MFC single document, a program that can display BMP format pictures in MFC)
    2020-04-28 15:39:24下载
    积分:1
  • 696518资源总数
  • 105895会员总数
  • 18今日下载