登录
首页 » Asm » q1

q1

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

  • mode
    一个文本搜索的console程序,可以从一个txt文本文件中查找数据 不错的(A text search console procedures, can look for data a TXT text file)
    2017-04-29 20:03:36下载
    积分:1
  • 使用IO完成端口异步通讯的VC源代码
    使用IO完成端口异步通讯的VC源代码- 服务端程序 将客户端发来的信息发送回客户端-use IO completed port asynchronous communications source code VC-end services to the client process to the information sent back to Client
    2022-05-22 18:26:00下载
    积分:1
  • 序主要功能有:“现金管理”、“存款管理”、“债权管理”、“债务管理”这4个功能。 服务器需开启SQLite和SQLite PDO Driver。(PHP...
    本程序主要功能有:“现金管理”、“存款管理”、“债权管理”、“债务管理”这4个功能。 服务器需开启SQLite和SQLite PDO Driver。(PHP5以后的版本都自带了SQLite) 在inc.php中可以修改数据库地址和管理员密码。-The main function of this procedure are as follows: "cash management", "deposit-taking management," "debt management", "debt management" in this function 4. Servers need to open a SQLite and SQLite PDO Driver. (PHP5 own future versions of SQLite) Inc.php can be modified in the database address and an administrator password.
    2022-04-27 21:39:46下载
    积分:1
  • qidongshiyan
    非线性气动系统实验的源代码,使用滑膜控制的方法(Pneumatic system test source code)
    2010-05-10 17:08:30下载
    积分:1
  • area
    定义一个基类MyGraph,要求有一个纯虚函数double Area()=0。从基类派生一个圆类Circle和矩形类Rectangle,再由Rectangle类派生出Square类,分别给出Area()实现。 重载“>>”,实现对图形信息的输入。在主函数中计算三种形状的面积,并显示输出。 (Define a base class MyGraph, requires a pure virtual function double Area () = 0. Derive a circle and a rectangle class Rectangle Circle class from the base class, and then by Square Rectangle class derived class, are given Area () implementation. Reload " > > " to achieve the input of graphical information. Calculate the shape of the three main functions in the area, and display output.)
    2014-02-07 23:13:19下载
    积分:1
  • Homotopy 同伦算法求矩阵逆
    matlab开发环境中,主要用于同伦算法求伪逆矩阵进行分析。(HOMOTOPY CONTINUATION METHODS in matlab)
    2018-01-27 15:49:11下载
    积分:1
  • sac
    读取sac文件,包括头文件读取以及头文件的写入(read sac file,including reading sacheaders and writing sacheaders and get sacheaders)
    2020-09-14 10:37:57下载
    积分:1
  • dzzrbhl
    matlabtx319-《Matlab 6,X辅助图像处理》源代码,(Matlabtx319- the Matlab 6, X auxiliary image processing source code,)
    2017-05-18 07:48:56下载
    积分:1
  • IVS2
    说明:  Intelligent Video Surveillance test2
    2019-02-16 20:49:36下载
    积分:1
  • sj20170320
    基于c#的移动端跨平台xamarin 里面就简单做一个表格listview ,不过没有mac 大致了解下就好(C# based mobile terminal cross platform xamarin, which simply do a form listview, but not MAC general understanding of the next good)
    2017-07-13 21:10:32下载
    积分:1
  • 696516资源总数
  • 106442会员总数
  • 11今日下载